/** * Creates a new array list and fills it with a given type-specific collection. * * @param c a type-specific collection that will be used to fill the array list. */ public IdentityArrayList(final ObjectCollection<? extends K> c) { this(c.size()); size = ObjectIterators.unwrap(c.iterator(), a); }
@Override public Iterator<Result> iterator() { return delegate.values().iterator(); }
@Override public ObjectIterator<K> iterator() { return collection.iterator(); } @Override
@Override public ObjectIterator<K> iterator() { return ObjectIterators.unmodifiable(collection.iterator()); } @Override
@Override public Iterator<Result> iterator() { return delegate.values().iterator(); }
/** * Creates a new array list and fills it with a given type-specific collection. * * @param c * a type-specific collection that will be used to fill the array * list. */ public ObjectArrayList(final ObjectCollection<? extends K> c) { this(c.size()); size = ObjectIterators.unwrap(c.iterator(), a); } /**
/** Creates a new array list and fills it with a given type-specific collection. * * @param c a type-specific collection that will be used to fill the array list. */ public IdentityArrayList ( final ObjectCollection <? extends K> c ) { this( c.size() ); size = ObjectIterators.unwrap( c.iterator(), a ); } /** Creates a new array list and fills it with a given type-specific list.
/** * Finds all child paths coming from any of the given parents * @param toCheck nodes to check for children * @param parents parents to identify * @param matches output collection of identified paths */ private Collection<TraversalNode> removeChildPaths(Iterable<KmerPathNode> toCheck, Set<KmerPathNode> parents) { Collection<TraversalNode> matches = new ArrayList<>(); for (KmerPathNode node : toCheck) { AbstractInt2ObjectSortedMap<TraversalNode> cache = memoized.get(node); if (cache == null || cache.isEmpty()) continue; Iterator<TraversalNode> it = cache.values().iterator(); while (it.hasNext()) { TraversalNode tn = it.next(); if (tn.parent != null && parents.contains(tn.parent.node.node())) { it.remove(); matches.add(tn); } } } return matches; } /**
private void doClose() { ObjectIterator<AveragePixelsSourceBands> it = this.validRegionsMap.values().iterator(); while (it.hasNext()) { AveragePixelsSourceBands value = it.next(); WeakReference<AveragePixelsSourceBands> reference = new WeakReference<>(value); reference.clear(); } this.validRegionsMap.clear(); }
/** * Put an image into the repository (note: the repository is only keeping a * weak reference!) * * @param img Image to put * @return Key */ public static int registerImage(RenderedImage img) { synchronized(images) { int key = counter; counter++; assert (images.get(key) == null); images.put(key, new SoftReference<>(img)); // Reorganize map, purge old entries if(counter % 50 == 49) { for(Iterator<SoftReference<RenderedImage>> iter = images.values().iterator(); iter.hasNext();) { SoftReference<RenderedImage> ref = iter.next(); if(ref == null || ref.get() == null) { iter.remove(); } } } if(LOG.isDebuggingFiner()) { LOG.debugFiner("Registered image: " + key); } return key; } }
/** * Returns the memoized predecessor of the given path * @return predecessor node, null if no single predecessor is defined for the entire interval */ public KmerPathNode getParent(KmerPathNode node, int start, int end) { AbstractInt2ObjectSortedMap<TraversalNode> cache = memoized.get(node); Iterator<TraversalNode> it = cache.tailMap(start).values().iterator(); if (it.hasNext()) { TraversalNode existing = it.next(); if (existing.node.firstStart() <= start && existing.node.firstEnd() >= end) { if (existing.parent != null) { return existing.parent.node.node(); } } } return null; } /**
public final IntSet processResult(int threadCount, Executor threadPool) throws Exception { Int2ObjectMap<PixelSourceBands> averagePixelsPerSegment = computeStatisticsPerRegion(this.validRegionsMap); doClose(); IntSet validRegionIds = doTrimming(threadCount, threadPool, averagePixelsPerSegment, this.degreesOfFreedom); // reset the references ObjectIterator<PixelSourceBands> it = averagePixelsPerSegment.values().iterator(); while (it.hasNext()) { PixelSourceBands value = it.next(); WeakReference<PixelSourceBands> reference = new WeakReference<PixelSourceBands>(value); reference.clear(); } averagePixelsPerSegment.clear(); WeakReference<Int2ObjectMap<PixelSourceBands>> reference = new WeakReference<Int2ObjectMap<PixelSourceBands>>(averagePixelsPerSegment); reference.clear(); return validRegionIds; }
n = value2factoryClass.values().size(); documentFactory = new DocumentFactory[ n ]; Iterator<Class<? extends DocumentFactory>> it = value2factoryClass.values().iterator(); for ( int f = 0; f < n; f++ ) { Class<? extends DocumentFactory> documentFactoryClass = it.next();
n = value2factoryClass.values().size(); documentFactory = new DocumentFactory[ n ]; Iterator<Class<? extends DocumentFactory>> it = value2factoryClass.values().iterator(); for ( int f = 0; f < n; f++ ) { Class<? extends DocumentFactory> documentFactoryClass = it.next();
n = value2factoryClass.values().size(); documentFactory = new DocumentFactory[ n ]; Iterator<Class<? extends DocumentFactory>> it = value2factoryClass.values().iterator(); for ( int f = 0; f < n; f++ ) { Class<? extends DocumentFactory> documentFactoryClass = it.next();
n = value2factoryClass.values().size(); documentFactory = new DocumentFactory[ n ]; Iterator<Class<? extends DocumentFactory>> it = value2factoryClass.values().iterator(); for ( int f = 0; f < n; f++ ) { Class<? extends DocumentFactory> documentFactoryClass = it.next();
return; Iterator<? extends Comparable> iterator = map.values().iterator(); int numToRemove = map.size() - count; counter = 0;
/** * Creates a new big-array big list and fills it with a given type-specific * collection. * * @param c * a type-specific collection that will be used to fill the array * list. */ public ObjectBigArrayBigList(final ObjectCollection<? extends K> c) { this(c.size()); for (ObjectIterator<? extends K> i = c.iterator(); i.hasNext();) add(i.next()); } /**
@Override public void removeStalePortalLocations(long worldTime) { if (worldTime % 100L == 0L) { ObjectIterator<Teleporter.PortalPosition> objectIterator = this.destinationCoordinateCache.values().iterator(); while (objectIterator.hasNext()) { TeleporterErebus.PortalPosition portalPosition = (TeleporterErebus.PortalPosition) objectIterator.next(); if (portalPosition == null || portalPosition.lastUpdateTime < worldTime - 300L) { objectIterator.remove(); } } } } }
private boolean nothingToRecycle() { if(generatorsMap.size() == 1) { final LoadGenerator<I, O> soleLoadGenerator = generatorsMap.values().iterator().next(); try { if(soleLoadGenerator.isStarted()) { return false; } } catch(final RemoteException e) { LogUtil.exception(Level.WARN, e, "Failed to check the load generator state"); } // load generator has done its work final long generatedIoTasks = soleLoadGenerator.getGeneratedTasksCount(); if( soleLoadGenerator.isRecycling() && counterResults.sum() >= generatedIoTasks && // all generated I/O tasks executed at least once latestIoResultsPerItem.size() == 0 // no successful I/O results ) { return true; } } return false; }