Exemple #1
0
 public static void main(String[] args) {
   RandomList<String> rs = new RandomList<String>();
   for (String s : ("lla asssa aa asa saa saa s asas").split(" ")) {
     rs.add(s);
   }
   for (int i = 0; i < rs.size(); i++) {
     System.out.println(rs.select());
   }
 }
  static Collection<EndPoint> randomEndPoints(Node caller, int total) {

    Set<EndPoint> res = new HashSet<EndPoint>();

    if (seeds.isEmpty()) res.add(nodes.randomElement().endpoint);
    else
      while (res.size() < Math.min(total, seeds.size())) {
        res.add(seeds.randomElement().endpoint);
      }

    seeds.add(caller);
    return res;
  }
 static void store(Node n) {
   nodes.add(n);
 }