\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{Ptero} \pdfinfo{ /Title (java-coding-interview.pdf) /Creator (Cheatography) /Author (Ptero) /Subject (Java Coding Interview 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}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \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{Java Coding Interview Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Ptero} via \textcolor{DarkBackground}{\uline{cheatography.com/190551/cs/39699/}}} \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}Ptero \\ \uline{cheatography.com/ptero} \\ \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 1st August, 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*}{3} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Wrapper Class}} \tn % Row 0 \SetRowColor{LightBackground} byte & Byte \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} short & Short \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} int & Integer \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} long & Long \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} float & Float \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} double & Double \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} boolean & Boolean \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} char & Character \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Min Max}} \tn % Row 0 \SetRowColor{LightBackground} int min & Integer.MIN\_VALUE // -2\textasciicircum{}31 \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} int max & Integer.MAX\_VALUE // 2\textasciicircum{}31-1 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} min & int min = Math.min(a, b); \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} max & int max = Math.max(a, b); \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} array min & int min = \seqsplit{Collections.min(Arrays.asList(arr));} \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} array max & int max = \seqsplit{Collections.max(Arrays.asList(arr));} \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.54747 cm} x{4.42953 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Math}} \tn % Row 0 \SetRowColor{LightBackground} abs & int abs = Math.abs(num); \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.29402 cm} x{3.68298 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Debug}} \tn % Row 0 \SetRowColor{LightBackground} print array & \seqsplit{System.out.println(Arrays.toString(arr));} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} print 2D array & \seqsplit{System.out.println(Arrays.deepToString(arr));} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} print map & \seqsplit{System.out.println(Arrays.asList(map));} \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{String}} \tn % Row 0 \SetRowColor{LightBackground} new & String str = "string"; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} get & char c = str.charAt(0); \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} length & int len = str.length(); \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} check emty & if (str.isEmpty()) \{...\} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} compare & if (s1.equals(s2)) \{...\}\{\{nl\}\}// or\{\{nl\}\}if (s1.compareTo(s2) == 0) \{...\} \tn % Row Count 7 (+ 3) % Row 5 \SetRowColor{white} sub string & String sub = str.substring(begin, end); \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} check substring & if (str.contains(sub)) \{...\} \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} split & String{[}{]} arr = str.split("{[}\textbackslash{}\textbackslash{}{]}+"); \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} split char & import java.util.regex.Pattern;\{\{nl\}\}String{[}{]} arr = \seqsplit{word.split(Pattern.quote(Character.toString('.')));} \tn % Row Count 17 (+ 4) % Row 9 \SetRowColor{white} to char array & char{[}{]} arr = str.toCharArray(); \tn % Row Count 19 (+ 2) % Row 10 \SetRowColor{LightBackground} from char array & char{[}{]} arr = \{'s', 't', 'r'\};\{\{nl\}\}String str = new String(arr); \tn % Row Count 22 (+ 3) % Row 11 \SetRowColor{white} join string array & String{[}{]} arr = new String{[}{]} \{"a","b","c"\};\{\{nl\}\}String joined = String.join(",", arr); \tn % Row Count 26 (+ 4) % Row 12 \SetRowColor{LightBackground} to string array & int{[}{]} arr = \{1, 2, 3\};\{\{nl\}\}String{[}{]} strArr = new String{[}arr.length{]};\{\{nl\}\}for (int i = 0; i \textless{} arr.length; ++i) \{\{\{nl\}\} strArr{[}i{]} = String.valueOf(arr{[}i{]});\{\{nl\}\}\} \tn % Row Count 32 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{String (cont)}} \tn % Row 13 \SetRowColor{LightBackground} char to string & String str = Character.toString(','); \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Array}} \tn % Row 0 \SetRowColor{LightBackground} new & int{[}{]} arr = new int{[}{]}\{0\};\{\{nl\}\}// or\{\{nl\}\}int{[}{]} arr = \{1,2,3\};\{\{nl\}\}// or\{\{nl\}\}int{[}{]} arr = new int{[}3{]}; \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} new 2D & int{[}{]}{[}{]} arr = new int{[}height{]}{[}width{]}; \tn % Row Count 7 (+ 2) % Row 2 \SetRowColor{LightBackground} length & int len = arr.length; \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} fill & Arrays.fill(arr, val); \tn % Row Count 9 (+ 1) % Row 4 \SetRowColor{LightBackground} fill 2D & \seqsplit{Arrays.stream(arr).forEach(a} -\textgreater{} Arrays.fill(a, val)); \tn % Row Count 12 (+ 3) % Row 5 \SetRowColor{white} compare & if (Arrays.equals(arr1, arr2)) \{...\} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} traverse & for (int item : arr) \{...\} \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} sort ascending, inplace & import java.util.Arrays;\{\{nl\}\}Arrays.sort(arr); \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} sort descending, inplace & import java.util.*;\{\{nl\}\}Arrays.sort(arr, \seqsplit{Collections.reverseOrder());} \tn % Row Count 21 (+ 3) % Row 9 \SetRowColor{white} sum & int sum = \seqsplit{Arrays.stream(arr).sum();} \tn % Row Count 23 (+ 2) % Row 10 \SetRowColor{LightBackground} find index & int index = \seqsplit{Arrays.asList(arr).indexOf(num);} \tn % Row Count 25 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Array List}} \tn % Row 0 \SetRowColor{LightBackground} include & import java.util.*; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} new & List\textless{}Integer\textgreater{} list = new ArrayList\textless{}Integer\textgreater{}(); \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} new 2D & List\textless{}List\textless{}Integer\textgreater{}\textgreater{} list = new ArrayList\textless{}List\textless{}Integer\textgreater{}\textgreater{}(size); \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} check empty & if (list.isEmpty()) \{...\} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} compare & if (list1.equals(list2)) \{...\} \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} add to tail & list.add(num); \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} get & int num = list.get(index); \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} size & int size = list.size(); \tn % Row Count 12 (+ 1) % Row 8 \SetRowColor{LightBackground} to array & Integer{[}{]} arr = new Integer{[}list.size(){]};\{\{nl\}\}list.toArray(arr); \tn % Row Count 15 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Linked List}} \tn % Row 0 \SetRowColor{LightBackground} include & import java.util.*; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} new & LinkedList\textless{}Integer\textgreater{} list = new LinkedList\textless{}Integer\textgreater{}(); \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} new 2D & List\textless{}List\textless{}Integer\textgreater{}\textgreater{} list = new ArrayList\textless{}List\textless{}Integer\textgreater{}\textgreater{}(size); \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} add to head & list.addFirst(num); \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} add to tail & list.add(num);\{\{nl\}\}// or\{\{nl\}\}list.addLast(num); \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} get head & int num = list.getFirst(); \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} get tail & int num = list.getLast(); \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} delete head & list.remove();\{\{nl\}\}// or\{\{nl\}\}list.removeFirst(); \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} delete tail & list.removeLast(); \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} size & int size = list.size(); \tn % Row Count 16 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Stack}} \tn % Row 0 \SetRowColor{LightBackground} include & import java.util.*; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} new & Stack\textless{}Integer\textgreater{} stack = new Stack\textless{}\textgreater{}(); \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} push & stack.push(num); \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} pop & int num = stack.pop(); \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} top & int num = stack.peak(); \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} size & int size = stack.size(); \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} check empty & if (stack.empty()) \{...\} \tn % Row Count 9 (+ 2) % Row 7 \SetRowColor{white} to array & Integer{[}{]} arr = new Integer{[}stack.size(){]};\{\{nl\}\}stack.toArray(arr); \tn % Row Count 12 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Queue}} \tn % Row 0 \SetRowColor{LightBackground} include & import java.util.*; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} new & Queue\textless{}Integer\textgreater{} queue = new LinkedList\textless{}Integer\textgreater{}(); \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} push & queue.add(num); \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} pop & int num = queue.poll(); \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} get front & int num = queue.peek(); \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} size & int size = queue.size(); \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} check empty & if (queue.isEmpty()) \{...\} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Heap}} \tn % Row 0 \SetRowColor{LightBackground} include & import java.util.*; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} new min heap & Queue\textless{}Integer\textgreater{} minHeap = new PriorityQueue\textless{}Integer\textgreater{}(); \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} new max heap & Queue\textless{}Integer\textgreater{} maxHeap = new PriorityQueue\textless{}Integer\textgreater{}(Collections.reverseOrder()); \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} push & heap.add(num); \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} pop & int num = heap.remove(); \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} get top & int num = heap.peek(); \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} size & int size = heap.size(); \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} check empty & if (heap.isEmpty()) \{...\} \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} add array & \seqsplit{heap.addAll(Arrays.asList(arr));} \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Hash Set}} \tn % Row 0 \SetRowColor{LightBackground} include & import java.util.*; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} new & Set\textless{}Integer\textgreater{} set = new HashSet\textless{}\textgreater{}(); \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} add & set.add(num); \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} delete & set.remove(num); \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} check in set & if (set.contains(num)) \{...\} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} iterate & for (int num : set) \{...\} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} size & int size = set.size(); \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} check empty & if (set.isEmpty()) \{...\} \tn % Row Count 11 (+ 2) % Row 8 \SetRowColor{LightBackground} to array & String arr = new String{[}set.size(){]};\{\{nl\}\}set.toArray(arr); \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.54287 cm} x{3.43413 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Hash Table}} \tn % Row 0 \SetRowColor{LightBackground} include & import java.util.*; \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} new & Hashtable\textless{}Integer, Integer\textgreater{} table = new Hashtable\textless{}\textgreater{}(); \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} set & table.put(key, val); \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} get & int val = table.get(key); \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} get default & int val = table.getOrDefault(key, default); \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} delete & table.remove(key); \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} check key in table & if (table.containsKey(key)) \{...\} \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} check val in table & if \seqsplit{(table.containsValue(val))} \{...\} \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} iterate & for (Integer key : table.keySet()) \{...\} \tn % Row Count 14 (+ 2) % Row 9 \SetRowColor{white} size & int size = table.size(); \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} check empty & if (table.isEmpty()) \{...\} \tn % Row Count 16 (+ 1) % Row 11 \SetRowColor{white} keys to array & String{[}{]} arr = new String{[}map.size(){]};\{\{nl\}\}map.keySet().toArray(arr); \tn % Row Count 19 (+ 3) % Row 12 \SetRowColor{LightBackground} values to array & Integer{[}{]} arr = new Integer{[}map.size(){]};\{\{nl\}\}map.values().toArray(arr); \tn % Row Count 22 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}