MCPcopy Create free account
hub / github.com/Berkeley-CS61B/skeleton-sp23 / of

Method of

lab03/src/common/IntList.java:31–37  ·  view source on GitHub ↗

Method to create an IntList from an argument list. You don't have to understand this code. We have it here because it's convenient with testing. It's used like this: IntList myList = IntList.of(1, 2, 3, 4, 5); will create an IntList 1 -> 2 -> 3 -> 4 -> 5 -> null. You can pass in any number o

(int... argList)

Source from the content-addressed store, hash-verified

29 * IntList mySmallerList = IntList.of(1, 4, 9);
30 */
31 public static IntList of(int... argList) {
32 if (argList.length == 0)
33 return null;
34 int[] restList = new int[argList.length - 1];
35 System.arraycopy(argList, 1, restList, 0, argList.length - 1);
36 return new IntList(argList[0], IntList.of(restList));
37 }
38
39 public boolean equals(Object other) {
40 if (other instanceof IntList oL) {

Callers 9

digitsToIntListMethod · 0.95
MachineStageMethod · 0.45
SpeciesListStageClass · 0.45
SpeciesListStageMethod · 0.45
AdventureGameMethod · 0.45
BeeCountingStageMethod · 0.45
PalindromeStageMethod · 0.45
argumentsForTestStageMethod · 0.45
findMaxesMethod · 0.45

Calls

no outgoing calls

Tested by 2

argumentsForTestStageMethod · 0.36
findMaxesMethod · 0.36