Beispiel #1
0
  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());
  }
Beispiel #2
0
 private static void put(String s) {
   Integer i = parse(s);
   list.put(i);
   System.out.println("Put: " + i + " (Size: " + list.size() + ")");
 }
Beispiel #3
0
 private static void size() {
   System.out.println("Size: " + list.size());
 }
Beispiel #4
0
 private static void clear() {
   list.clear();
   System.out.println("Cleared (Size: " + list.size() + ")");
 }
Beispiel #5
0
 private static void remove(String s) {
   Integer i = parse(s);
   System.out.println("Remove: " + list.remove(i) + " (Size: " + list.size() + ")");
 }