From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02 //start auto-imports
03 importimport means to make the classes and/or packages available in this program java.util.*;
04 //end auto-imports
05
06
07 /**
08 * All about my helper classclass is a group of fields and methods used for making objects.
09 * @authornull My Name Here
10 */
11 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects StringCollection
12 {open braces start code blocks and must be matched with a close brace
13 privateprivate is used to restrict access to the current class only ArrayList<String> all;
14
15 publicpublic is used to indicate unrestricted access (any other class can have access) StringCollection()
16 {open braces start code blocks and must be matched with a close brace
17 all=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArrayList<String>();
18 }close braces end code blocks and must match an earlier open brace
19
20 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value add(String one)
21 {open braces start code blocks and must be matched with a close brace
22 all.add(one);
23 }close braces end code blocks and must match an earlier open brace
24
25 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value sortByJam()
26 {open braces start code blocks and must be matched with a close brace
27 ILikeJamComparator compare=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ILikeJamComparator();
28 Collections.sort(all, compare);
29 }close braces end code blocks and must match an earlier open brace
30
31 publicpublic is used to indicate unrestricted access (any other class can have access) String[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays getAll()
32 {open braces start code blocks and must be matched with a close brace
33 returnreturn means to provide the result of the method and/or cease execution of the method immediately all.toArray(newnew is used to create objects by calling the constructor String[brackets are typically used to declare, initialize and index (indicate which element of) arrays0]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
34 }close braces end code blocks and must match an earlier open brace
35 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/StringCollection.java