Java Code Examples for gnu.trove.iterator.TLongIterator#hasNext()
The following examples show how to use
gnu.trove.iterator.TLongIterator#hasNext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockVectorSet.java From PGM with GNU Affero General Public License v3.0 | 6 votes |
@Override public Iterator<BlockVector> iterator() { final TLongIterator iter = this.set.iterator(); return new Iterator<BlockVector>() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public BlockVector next() { return BlockVectors.decodePos(iter.next()); } @Override public void remove() { iter.remove(); } }; }
Example 2
Source File: BlockVectorSet.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
@Override public Iterator<BlockVector> iterator() { final TLongIterator iter = this.set.iterator(); return new Iterator<BlockVector>() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public BlockVector next() { return decodePos(iter.next()); } @Override public void remove() { iter.remove(); } }; }
Example 3
Source File: BlockVectorSet.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
/** * Return an iterator that reuses a single BlockVector instance, * mutating it for each iteration. */ public Iterator<BlockVector> mutableIterator() { final TLongIterator iter = set.iterator(); return new Iterator<BlockVector>() { final BlockVector value = new BlockVector(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public BlockVector next() { return decodePos(iter.next(), value); } }; }
Example 4
Source File: TLongMultiIterator.java From tinkergraph-gremlin with Apache License 2.0 | 6 votes |
@Override public boolean hasNext() { if (this.current >= iterators.size()) return false; TLongIterator currentIterator = iterators.get(this.current); while (true) { if (currentIterator.hasNext()) { return true; } else { this.current++; if (this.current >= iterators.size()) break; currentIterator = iterators.get(this.current); } } return false; }
Example 5
Source File: TLongMultiIterator.java From tinkergraph-gremlin with Apache License 2.0 | 6 votes |
@Override public long next() { if (iterators.isEmpty()) throw FastNoSuchElementException.instance(); TLongIterator currentIterator = iterators.get(this.current); while (true) { if (currentIterator.hasNext()) { return currentIterator.next(); } else { this.current++; if (this.current >= iterators.size()) break; currentIterator = iterators.get(current); } } throw FastNoSuchElementException.instance(); }
Example 6
Source File: CachedGridEntry.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Collection<IBlockState> getGeneratedBlocks(OreDepositDefinition definition, int chunkX, int chunkZ) { long chunkId = (long) chunkX << 32 | chunkZ & 0xFFFFFFFFL; ChunkDataEntry chunkDataEntry = dataByChunkPos.get(chunkId); if (chunkDataEntry != null) { TLongSet longSet = chunkDataEntry.generatedBlocksSet.get(definition); ArrayList<IBlockState> blockStates = new ArrayList<>(); TLongIterator iterator = longSet.iterator(); while (iterator.hasNext()) blockStates.add(Block.getStateById((int) iterator.next())); return blockStates; } return Collections.emptyList(); }
Example 7
Source File: Serializer.java From tinkergraph-gremlin with Apache License 2.0 | 5 votes |
/** * format: two `Map<Label, Array<EdgeId>>`, i.e. one Map for `IN` and one for `OUT` edges */ private void packEdgeIds(final MessageBufferPacker packer, final Map<String, TLongSet> edgeIdsByLabel) throws IOException { packer.packMapHeader(edgeIdsByLabel.size()); for (Map.Entry<String, TLongSet> entry : edgeIdsByLabel.entrySet()) { final String label = entry.getKey(); packer.packString(label); final TLongSet edgeIds = entry.getValue(); packer.packArrayHeader(edgeIds.size()); final TLongIterator edgeIdIter = edgeIds.iterator(); while (edgeIdIter.hasNext()) { packer.packLong(edgeIdIter.next()); } } }
Example 8
Source File: TLongHashSetSerializer.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
@Override public void write(Kryo kryo, Output output, TLongHashSet object) { output.writeInt(object.size(), true); TLongIterator it = object.iterator(); while (it.hasNext()) { kryo.writeObject(output, it.next()); } }
Example 9
Source File: ToXdrTables.java From monsoon with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static TLongIntMap buildTimestampLookupTable(TLongList timestamps) { final TLongIntMap lookupTable = new TLongIntHashMap(timestamps.size(), 4, -1, -1); final TLongIterator iter = timestamps.iterator(); for (int idx = 0; iter.hasNext(); ++idx) lookupTable.put(iter.next(), idx); return lookupTable; }