@Override public int[] toIntArray() { synchronized (sync) { return collection.toIntArray(); } } @Override
@Override public int[] toIntArray() { return collection.toIntArray(); } /*
/** * Creates a queue using the elements in a type-specific collection using a * given comparator. * * <p> * This constructor is more efficient than enqueing the elements of * {@code collection} one by one. * * @param collection * a collection; its elements will be used to initialize the queue. * @param c * the comparator used in this queue, or {@code null} for the natural * order. */ public IntHeapPriorityQueue(final IntCollection collection, final IntComparator c) { this(collection.toIntArray(), c); } /**
@Override public void removeAll(IntCollection positions) { int[] toRemove = positions.toIntArray(); IntArrays.quickSort(toRemove); int pos = 0; int last = 0; for (int i = 0; i < mapping.size(); i++) { if(i==toRemove[pos]) { pos++; continue; } mapping.set(last, mapping.getInt(i)); last++; } mapping.size(last); }
private static void convertSparseIntModel(Configuration conf, FSDataOutputStream output, String modelInputDir, ModelLineConvert lineConvert) throws IOException { Int2IntOpenHashMap[] data = ModelLoader.loadToIntMaps(modelInputDir, conf); for (int i = 0; i < data.length; i++) { Int2IntOpenHashMap row = data[i]; data[i] = null; if (row == null) { continue; } lineConvert.convertRowIndex(output, i); int[] indexes = row.keySet().toIntArray(); int[] values = row.values().toIntArray(); row = null; Sort.quickSort(indexes, values, 0, indexes.length - 1); for (int j = 0; j < indexes.length; j++) { lineConvert.convertFloat(output, indexes[j], values[j]); } } }
private void serializeTimestampIndexStore(final DataOutput out, final TimestampIndexStore timestampIndexStore) throws IOException { serialize(out, timestampIndexStore.elementType); serialize(out, timestampIndexStore.length); serialize(out, timestampIndexStore.getMap().keySet().toDoubleArray()); serialize(out, timestampIndexStore.getMap().values().toIntArray()); serialize(out, timestampIndexStore.garbageQueue.toIntArray()); serialize(out, timestampIndexStore.countMap); }
private void serializeTimestampIndexStore(final DataOutput out, final TimestampIndexStore timestampIndexStore) throws IOException { serialize(out, timestampIndexStore.elementType); serialize(out, timestampIndexStore.length); serialize(out, timestampIndexStore.getMap().keySet().toDoubleArray()); serialize(out, timestampIndexStore.getMap().values().toIntArray()); serialize(out, timestampIndexStore.garbageQueue.toIntArray()); serialize(out, timestampIndexStore.countMap); }