Package java.util

Examples of java.util.ArrayList.subList()


                ArrayList colList = new ArrayList(thisCollection);
                int startIndex = offset > 0 ? offset : 0;
                int endIndex = limit > 0 ? offset + limit : colList.size();

                endIndex = endIndex > colList.size() ? colList.size() : endIndex;
                List subList = colList.subList(startIndex, endIndex);

                newIterator = subList.iterator();
            } else {
                newIterator = thisCollection.iterator();
            }
View Full Code Here


            }
          }
        }
      }
      if (keys.size() > 100) {
        keys.subList(0, 50);
      }
      tagPool = new TreeMap<String, String>();
      tagPool.putAll(mapMe(keys));
      tagPool.putAll(treeTags);
      cache.put(cachePrefix, tagPool);
View Full Code Here

          sublist.add(entries[j]);
        }
      }
      Collections.sort(sublist);
      if (sublist.size() > MAX_SIZE) {
        sublist = sublist.subList(0, MAX_SIZE);
      }
      list.addAll(sublist);
      sublist.clear();
    }
    for (int i=0; i<list.size(); i++) {
View Full Code Here

                for(int j = i + 1; j < i + nodes.size(); j++) {
                    PathInfo pathInfo =
                        new PathInfo(
                            (NodeInfo)cycledNodes.get(i),
                            (NodeInfo)cycledNodes.get(j));
                    List result = cycledNodes.subList(i + 1, j + 1);
                    paths.put(pathInfo, result.toArray(new NodeInfo[0]));
                }
            }
            Collections.reverse(cycledNodes);
            for(int i = 0; i < nodes.size(); i++) {
View Full Code Here

                for(int j = i + 1; j < i + nodes.size(); j++) {
                    PathInfo pathInfo =
                        new PathInfo(
                            (NodeInfo)cycledNodes.get(i),
                            (NodeInfo)cycledNodes.get(j));
                    List result = cycledNodes.subList(i + 1, j + 1);
                    NodeInfo[] path = (NodeInfo[]) paths.get(pathInfo);
                    if ( result.size() < path.length ) {
                        paths.put(pathInfo, result.toArray(new NodeInfo[0]));
                    }
                }
View Full Code Here

                toPrefetch = owners;
                prefetchingAll = true;
            }
            else
            {
                toPrefetch = owners.subList(0, _limit);
                prefetchingAll = false;
            }

            Class saveClassToPrefetch = classToPrefetch;
            classToPrefetch = prefetcher.getItemClassDescriptor().getClassOfObject();
View Full Code Here

    }

    if (last == -1)
      lookups = new ArrayList();
    else
      lookups = new ArrayList(candidates.subList(0, last + 1));


    // need to also add TRUE and REQUIRED
    for (Property p : proplist) {
      if (p.getLookupBehaviour() != Property.Lookup.TRUE &&
View Full Code Here

    int remaining = pop.size() - nextgen.size(); // avoids rounding errors
    for (GeneticConfiguration cfg : pop.subList(start, start + remaining))
      nextgen.add(new GeneticConfiguration(cfg));

    if (nextgen.size() > size)
      nextgen = nextgen.subList(0, size);

    for (GeneticConfiguration cfg : nextgen) {
      double rr = cfg.getRecombinationRate();
      while (rr > Math.random()) {
        cfg.mateWith(population.pickRandomConfig());
View Full Code Here

          sublist.add(entries[j]);
        }
      }
      Collections.sort(sublist);
      if (sublist.size() > MAX_SIZE) {
        sublist = sublist.subList(0, MAX_SIZE);
      }
      list.addAll(sublist);
      sublist.clear();
    }
    for (int i=0; i<list.size(); i++) {
View Full Code Here

                for(int j = i + 1; j < i + nodes.size(); j++) {
                    PathInfo pathInfo =
                        new PathInfo(
                            (NodeInfo)cycledNodes.get(i),
                            (NodeInfo)cycledNodes.get(j));
                    List result = cycledNodes.subList(i + 1, j + 1);
                    paths.put(pathInfo, result.toArray(new NodeInfo[0]));
                }
            }
            Collections.reverse(cycledNodes);
            for(int i = 0; i < nodes.size(); i++) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.