private static void fill(String s) { Matcher match = numbers.matcher(s); int size, min, max; try { match.find(); size = Integer.valueOf(match.group()); match.find(); min = Integer.valueOf(match.group()); match.find(); max = Integer.valueOf(match.group()); } catch (Exception ex) { System.out.println("Unable to parse arguments."); return; } Integer[] added = new Integer[size]; for (int i = 0; i < size; i++) { added[i] = random(min, max); list.put(added[i]); } System.out.println("New size: " + list.size()); }
private static void put(String s) { Integer i = parse(s); list.put(i); System.out.println("Put: " + i + " (Size: " + list.size() + ")"); }
private static void size() { System.out.println("Size: " + list.size()); }
private static void clear() { list.clear(); System.out.println("Cleared (Size: " + list.size() + ")"); }
private static void remove(String s) { Integer i = parse(s); System.out.println("Remove: " + list.remove(i) + " (Size: " + list.size() + ")"); }