/** * Get an iterator over the entries of the map. If possible, this is a {@linkplain Long2DoubleMap.FastEntrySet fast iterator}. * * @param map The map. * @return An iterator over the map's entries. */ public static Iterator<Long2DoubleMap.Entry> fastEntryIterator(Long2DoubleMap map) { ObjectSet<Long2DoubleMap.Entry> entries = map.long2DoubleEntrySet(); if (entries instanceof Long2DoubleMap.FastEntrySet) { return ((Long2DoubleMap.FastEntrySet) entries).fastIterator(); } else { return entries.iterator(); } }
@Override public void seal() { sealed = true; sortedStringList = new String[rawStringSet.size()]; rawStringSet.toArray(sortedStringList); Arrays.sort(sortedStringList); if (sortedStringList.length == 0) { min = null; max = null; return; } // Update min/max based on raw docs. min = sortedStringList[0]; max = sortedStringList[sortedStringList.length - 1]; // Merge the raw and aggregated docs, so stats for dictionary creation are collected correctly. int numAggregated = aggregatedStringSet.size(); if (numAggregated > 0) { rawStringSet.addAll(aggregatedStringSet); sortedStringList = new String[rawStringSet.size()]; rawStringSet.toArray(sortedStringList); Arrays.sort(sortedStringList); } } }
}); coordinator.getSegmentAvailability().object2LongEntrySet().forEach( (final Object2LongMap.Entry<String> entry) -> { final String dataSource = entry.getKey();
private boolean contains(final BaseRowSnapshot row) { return this.rowSet.contains(row); }
public Object[] getLabels() { return labelMap.keySet().toArray(); }
/** * Returns a stream of the elements stored in the structure. * * @return a stream of the elements stored in the structure */ public Stream<T> getIds() { return t2imap.keySet().stream(); } }
currentCrawledURIs.put( Thread.currentThread(), null ); uri = visitQueue.take(); enqueued.remove( uri ); if ( visitedURIs.add( uri ) ) { try { currentCrawledURIs.put( Thread.currentThread(), uri ); if ( accept( newJob.uri ) ) { if ( local( newJob ) ) { if ( enqueued.add( newJob.uri ) ) visitQueue.add( newJob.uri );
private ObjectArrayList<BaseInformationRecords.CountInfo.Builder> aggregateCounts(ObjectArrayList<BaseInformationRecords.CountInfo.Builder> countsToKeep) { toRemove.clear(); Collections.sort(countsToKeep, comparator); BaseInformationRecords.CountInfo.Builder previous = null; for (BaseInformationRecords.CountInfo.Builder count : countsToKeep) { if (previous != null) { if (comparator.compare(previous, count) == 0) { int sumForward = previous.getGenotypeCountForwardStrand() + count.getGenotypeCountForwardStrand(); int sumReverse = previous.getGenotypeCountReverseStrand() + count.getGenotypeCountReverseStrand(); previous.setGenotypeCountForwardStrand(sumForward); previous.setGenotypeCountReverseStrand(sumReverse); previous.setMatchesReference(previous.getFromSequence().equals(previous.getToSequence())); toRemove.add(count); } } previous = count; } countsToKeep.removeAll(toRemove); return countsToKeep; }
public boolean remove(Element element) { return elementSet.remove(element); }
public void addEntity( Entity entity ) { if ( !this.visible.contains( entity ) && !this.player.equals( entity ) ) { LOGGER.debug( "Spawning entity {} for {}", entity, this.player.getName() ); io.gomint.server.entity.Entity implEntity = (io.gomint.server.entity.Entity) entity; implEntity.preSpawn( this.player.getConnection() ); this.player.getConnection().addToSendQueue( implEntity.createSpawnPacket( this.player ) ); implEntity.postSpawn( this.player.getConnection() ); implEntity.attach( this.player ); this.visible.add( entity ); } }
public void forEach(Consumer<BaseRowSnapshot> action) { this.rowSet.forEach(action); }
public boolean isVisible( Entity entity ) { return Objects.equals( entity, this.player ) || this.visible.contains( entity ); }
public Object[] getLabels() { return labelMap.keySet().toArray(); }
@Override public double evaluate() { return itemCount.keySet().stream() .mapToDouble((i) -> itemWeight.getDouble(i) * nov(i)) .sum() / numUsers; }
public boolean remove(Element element) { return elementSet.remove(element); }
@Override public boolean equals(final Object o) { if (o == this) return true; if (!(o instanceof Map)) return false; Map<?, ?> m = (Map<?, ?>) o; if (m.size() != 1) return false; return m.entrySet().iterator().next().equals(entrySet().iterator().next()); } @Override
@Override public boolean retainAll(Collection<?> c) { checkCollection(c); if (!c.isEmpty()) { ObjectSet<EdgeImpl> set = new ObjectOpenHashSet(c.size()); for (Object o : c) { checkNonNullObject(o); checkEdgeExists((EdgeImpl) o); set.add((EdgeImpl) o); } boolean changed = false; EdgeStoreIterator itr = iterator(); while (itr.hasNext()) { EdgeImpl e = itr.next(); if (!set.contains(e)) { itr.remove(); changed = true; } } return changed; } else { clear(); } return false; }
/** * Iterates {@linkplain FastEntrySet#fastForEach(Consumer) quickly}, if * possible, on the {@linkplain Map#entrySet() entry set} of the provided * {@code map}. * * @param map * a map on which we will try to iterate * {@linkplain FastEntrySet#fastForEach(Consumer) quickly}. * @param consumer * the consumer that will be passed to * {@link FastEntrySet#fastForEach(Consumer)}, if possible, or to * {@link Iterable#forEach(Consumer)}. * @since 8.1.0 */ public static void fastForEach(Int2IntMap map, final Consumer<? super Int2IntMap.Entry> consumer) { final ObjectSet<Int2IntMap.Entry> entries = map.int2IntEntrySet(); if (entries instanceof Int2IntMap.FastEntrySet) ((Int2IntMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**