\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{lucamazzza} \pdfinfo{ /Title (java17.pdf) /Creator (Cheatography) /Author (lucamazzza) /Subject (Java17 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{DB0000} \definecolor{LightBackground}{HTML}{FCEFEF} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Java17 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{lucamazzza} via \textcolor{DarkBackground}{\uline{cheatography.com/194481/cs/40573/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}lucamazzza \\ \uline{cheatography.com/lucamazzza} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 2nd October, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{1.444 cm} x{1.292 cm} x{4.864 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Primitive Data types}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Name}} & {\bf{Size}} & {\bf{Values}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `byte` & 1 B & -128 → 127 \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \seqsplit{`short`} & 2 B & -32768 → 32767 \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} `int` & 4 B & \textasciitilde{}-2∙10$^{\textrm{9}}$ → \textasciitilde{}2∙10$^{\textrm{9}}$ \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} `long` & 8 B & \textasciitilde{}-9∙10$^{\textrm{1}}$$^{\textrm{5}}$ → \textasciitilde{}9∙10$^{\textrm{1}}$$^{\textrm{5}}$ \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \seqsplit{`float`} & 4 B & 6-7 decimal digits \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} \seqsplit{`double`} & 8 B & 15 decimal digits \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} \seqsplit{`boolean`} & 1 b & `true` or `false` \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} `char` & 2 B & Characters or ASCII \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.296 cm} x{1.512 cm} x{2.88 cm} x{1.512 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{Comparison Operators}} \tn % Row 0 \SetRowColor{LightBackground} Equal & `x == y` & Not equal & `x != y` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Less & `x \textless{} y` & Less or equal & `x \textless{}= y` \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \seqsplit{Greater} & `x \textgreater{} y` & Greater or equal & `x \textgreater{}= y` \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{String Methods}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Usage}} & {\bf{Description}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `s.length();` & Length of a string \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \seqsplit{`s.charAt(x);`} & Extract the n\textasciicircum{}th\textasciicircum{} character \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{`s.toUpperCase();`} & Returns a copy of a string in ALL CAPS \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{`s.toLowerCase();`} & Returns a copy of a string in lowecase \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \seqsplit{`s.indexOf(c);`} & Returns the first occurring index of {\emph{c}} \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} \seqsplit{`s.replace(old}, new);` & Search and Replace \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} `s.split({\emph{RegEx}});` & Splits string into tokens \tn % Row Count 14 (+ 2) % Row 8 \SetRowColor{LightBackground} \seqsplit{`s.equals(s2);`} & Compares strings (true if equal) \tn % Row Count 16 (+ 2) % Row 9 \SetRowColor{white} \seqsplit{`s.compareTo(s2);`} & Returns "0" if equal, "+" if s \textgreater{} s2, "-" if s \textless{} s2 \tn % Row Count 18 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{IF Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// conditional handler \newline if ({\emph{condition}}) \{ \newline // pose a condition ... \newline \} else if ({\emph{other condition}}) \{ \newline // if first condition not met pose another one ... \newline \} else \{ \newline // if second condition not met finally ... \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{FOR EACH Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// self-iterating loop for iterable objects \newline for ({\emph{var: collection}}) \{ \newline {\emph{statements}} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{FOR Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// structured iterator for non-iterable objects \newline for (int i = 0; i \textless{} {\emph{max}}; i++) \{\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Continue}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{for (int i = 0; i \textless{} {\emph{max}}; i++) \{ \newline // jump to the next iteration \newline continue; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Break}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{while (true) \{ \newline // exit early a loop \newline break; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{TRY-CATCH Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// exception handler \newline try \{ \newline // try to do something \newline \} catch ({\emph{exception}} e) \{ \newline // when you fail do... \newline \} finally \{ \newline // when you are done do... \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Enumerals}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// "class" containing a group of constants \newline enum Name \{ \newline NAME1, \newline NAME2, \newline NAME3 \newline \} \newline // constant are accessible per dot notation \newline // they are typed as the declared enum \newline Name {\emph{var}} = Name.NAME1;} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Object Example}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{public class Object \{ \newline private \textless{}type\textgreater{} attr1; \newline public Object (\textless{}type\textgreater{} attr1) \{ \newline this.attr1 = attr1; \newline \} \newline public void method() \{ \newline // ... \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Interfaces}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// An interface manages accessibility of object \newline // it is an abstract object \newline public interface Intrf \{ \newline String const = "CIAO"; \newline public void method1(); \newline \} \newline public class Obj implements Intrf \{ \newline public void Obj() \{ \} \newline @override \newline public void method1() \{\} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Parent Class}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// parent class \newline public class Parent implements Intrf \{\} \newline // child class, inherits Parents characteristics \newline public class Child extends Parent \{\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{ArrayList Methods}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Usage}} & {\bf{Description}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `list.add({\emph{item}});` & Add {\emph{item}} to the list \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} `list.get({\emph{n}});` & Return the n\textasciicircum{}th\textasciicircum{} item \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} `list.size();` & Return number of item \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} `list.remove({\emph{n}});` & Remove the n\textasciicircum{}th\textasciicircum{} item \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} `list.set({\emph{n}}, {\emph{value}});` & Put at the n\textasciicircum{}th\textasciicircum{} position value \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.52 cm} x{6.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Non-Primitive Data Types}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Name}} & {\bf{Declaration}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} String & `String name = "Luca";` \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} Array & `{\emph{type}}{[}{]} = \{x, y\};` \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} Class & `{\emph{access}} class Obj \{ ... \}` \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{Interface} & `public interface ObjInterface \{ ... \}` \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{2.16 cm} x{5.84 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Boolean Operators}} \tn % Row 0 \SetRowColor{LightBackground} NOT & `! x` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} AND & `x \&\& y` \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} OR & `x || y` \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} XOR & `x \textasciicircum{} y` \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.64 cm} x{3.36 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Arithmetic Operators}} \tn % Row 0 \SetRowColor{LightBackground} Addition & `x + y` \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Subtraction & `x - y` \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Multiplication & `x * y` \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Division & `x / y` \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} Increment & `x++ ++x` \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} Decrement & `x-{}- -{}-x` \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} Modulus & `x \% y` \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{WHILE Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// pre-conditioned iterator ... \newline while ({\emph{condition}}) \{\}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Scanner}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{import java.utils.Scanner; \newline public class Obj\{ \newline public static void main (String{[}{]} args) \{ \newline Scanner input = new Scanner(System.in); \newline String str = input.nextLine(); \newline int i = input.nextInt(); \newline input.close(); \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{DO-WHILE Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// post-conditional iterator \newline do \{ \} while ({\emph{condition}});} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{SWITCH Statement}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// case-oriented condition handler \newline switch ({\emph{condition}}) \{ \newline case {\emph{value0}}: \newline {\emph{statements}} \newline break; \newline case {\emph{value1}}: \newline {\emph{statements}} \newline break; \newline default: \newline {\emph{statements}} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Ternary operator}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// same as an if, but inline! \newline {\emph{condition}} ? {\emph{iftrue}} : {\emph{iffalse}};} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Type conversion}} \tn % Row 0 \SetRowColor{LightBackground} `String` to any number & `int i = Integer.parseInt({\emph{str}});` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Any type to `String` & `String s = String.valueOf({\emph{value}});` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Between numeric types & `int i = (int) {\emph{number}};` \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.48 cm} x{3.52 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Array Utilities}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Usage}} & {\bf{Description}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Arrays.copyOf({\emph{og}}, {\emph{og}}.length);` & Copy array onto another one \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Recursion}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// method that sums all the number 1..10 \newline // attention! recursion can incur in an infinite loop \newline // handle it well \newline public static int sum(int start, int end) \{ \newline if (end \textgreater{} start) \{ \newline return end + sum(start, end - 1); \newline \} else \{ \newline return end; \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Access Definitions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Class}}} \tn % Row Count 1 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Package}}} \tn % Row Count 2 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Subclasses}}} \tn % Row Count 3 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Classes}}} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Usage of an Object}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{// to use an object \newline public static void main (String{[}{]} args) \{ \newline // declaration meets constructor method \newline Object obj = new Object(attr1); \newline obj.method(); \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Dynamic Data Types}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{import java.util.{\emph{; \newline \newline L​ist​\textless{}}}type{\emph{\textgreater{} names = ​ new ArrayL​ist​\textless{}}}type{\emph{\textgreater{}(); \newline \newline Vector\textless{}}}type{\emph{\textgreater{} vec = new Vector\textless{}}}type{\emph{\textgreater{}(); \newline \newline Stack\textless{}}}type*\textgreater{} stk= new Stack\textless{}\textgreater{}();} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.28 cm} x{4.72 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Dynamic Data Types Methods}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\}{\bf{Vector}}\{\{ac\}\}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `vec.add({\emph{value}});` & Add an element to the end \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} `vec.add({\emph{i}}, {\emph{value}});` & Add an element to a specific index \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{`vec.capacity();`} & Returns the current capacity \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} `vec.clear();` & Empty vector \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} `vec.clone();` & Clone the vector \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\}{\bf{Stack}}\{\{nl\}\}{\emph{Inherits from Vector}}\{\{ac\}\}\{\{bt=1\}\}} \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} `stk.empty();` & Returns true if head is empty \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} `stk.peek();` & Returns head of stack \tn % Row Count 14 (+ 1) % Row 9 \SetRowColor{white} `stk.pop();` & Delete head of stack \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} `stk.push({\emph{value}});` & Add an element at head \tn % Row Count 17 (+ 2) % Row 11 \SetRowColor{white} `stk.search({\emph{value}});` & Returns index of element \tn % Row Count 19 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}