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)
| 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) { |
no outgoing calls