}); coordinator.getSegmentAvailability().object2LongEntrySet().forEach( (final Object2LongMap.Entry<String> entry) -> { final String dataSource = entry.getKey();
public void forEach(Consumer<BaseRowSnapshot> action) { this.rowSet.forEach(action); }
/** * 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); } /**
/** * 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(Int2DoubleMap map, final Consumer<? super Int2DoubleMap.Entry> consumer) { final ObjectSet<Int2DoubleMap.Entry> entries = map.int2DoubleEntrySet(); if (entries instanceof Int2DoubleMap.FastEntrySet) ((Int2DoubleMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Long2ByteMap map, final Consumer<? super Long2ByteMap.Entry> consumer) { final ObjectSet<Long2ByteMap.Entry> entries = map.long2ByteEntrySet(); if (entries instanceof Long2ByteMap.FastEntrySet) ((Long2ByteMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Byte2CharMap map, final Consumer<? super Byte2CharMap.Entry> consumer) { final ObjectSet<Byte2CharMap.Entry> entries = map.byte2CharEntrySet(); if (entries instanceof Byte2CharMap.FastEntrySet) ((Byte2CharMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Double2FloatMap map, final Consumer<? super Double2FloatMap.Entry> consumer) { final ObjectSet<Double2FloatMap.Entry> entries = map.double2FloatEntrySet(); if (entries instanceof Double2FloatMap.FastEntrySet) ((Double2FloatMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Long2ShortMap map, final Consumer<? super Long2ShortMap.Entry> consumer) { final ObjectSet<Long2ShortMap.Entry> entries = map.long2ShortEntrySet(); if (entries instanceof Long2ShortMap.FastEntrySet) ((Long2ShortMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Short2BooleanMap map, final Consumer<? super Short2BooleanMap.Entry> consumer) { final ObjectSet<Short2BooleanMap.Entry> entries = map.short2BooleanEntrySet(); if (entries instanceof Short2BooleanMap.FastEntrySet) ((Short2BooleanMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Long2CharMap map, final Consumer<? super Long2CharMap.Entry> consumer) { final ObjectSet<Long2CharMap.Entry> entries = map.long2CharEntrySet(); if (entries instanceof Long2CharMap.FastEntrySet) ((Long2CharMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Float2IntMap map, final Consumer<? super Float2IntMap.Entry> consumer) { final ObjectSet<Float2IntMap.Entry> entries = map.float2IntEntrySet(); if (entries instanceof Float2IntMap.FastEntrySet) ((Float2IntMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Short2FloatMap map, final Consumer<? super Short2FloatMap.Entry> consumer) { final ObjectSet<Short2FloatMap.Entry> entries = map.short2FloatEntrySet(); if (entries instanceof Short2FloatMap.FastEntrySet) ((Short2FloatMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Char2ByteMap map, final Consumer<? super Char2ByteMap.Entry> consumer) { final ObjectSet<Char2ByteMap.Entry> entries = map.char2ByteEntrySet(); if (entries instanceof Char2ByteMap.FastEntrySet) ((Char2ByteMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Byte2IntMap map, final Consumer<? super Byte2IntMap.Entry> consumer) { final ObjectSet<Byte2IntMap.Entry> entries = map.byte2IntEntrySet(); if (entries instanceof Byte2IntMap.FastEntrySet) ((Byte2IntMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Double2BooleanMap map, final Consumer<? super Double2BooleanMap.Entry> consumer) { final ObjectSet<Double2BooleanMap.Entry> entries = map.double2BooleanEntrySet(); if (entries instanceof Double2BooleanMap.FastEntrySet) ((Double2BooleanMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Double2CharMap map, final Consumer<? super Double2CharMap.Entry> consumer) { final ObjectSet<Double2CharMap.Entry> entries = map.double2CharEntrySet(); if (entries instanceof Double2CharMap.FastEntrySet) ((Double2CharMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * 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(Char2FloatMap map, final Consumer<? super Char2FloatMap.Entry> consumer) { final ObjectSet<Char2FloatMap.Entry> entries = map.char2FloatEntrySet(); if (entries instanceof Char2FloatMap.FastEntrySet) ((Char2FloatMap.FastEntrySet) entries).fastForEach(consumer); else entries.forEach(consumer); } /**
/** * Performs a consumer action on index-value pairs of the non-zero * instance features. * * @param consumer int-double consumer */ public void consume(FeatureConsumer consumer) { features.int2DoubleEntrySet() .forEach(e -> consumer.accept(e.getIntKey(), e.getDoubleValue())); }
/** * Returns a map of item-score pairs. * * @param uidx index of the user whose scores are predicted * @return a map of item-score pairs */ @Override public Int2DoubleMap getScoresMap(int uidx) { Int2DoubleOpenHashMap scoresMap = new Int2DoubleOpenHashMap(); for (Entry<FastRankingRecommender<U, I>, Double> rw : recommenders) { double w = rw.getValue(); rw.getKey().getScoresMap(uidx).int2DoubleEntrySet() .forEach(e -> scoresMap.addTo(e.getIntKey(), w * e.getDoubleValue())); } return scoresMap; }
@Override public FastRecommendation getRecommendation(int uidx, int maxLength, IntPredicate filter) { if (uidx == -1) { return new FastRecommendation(uidx, new ArrayList<>(0)); } Int2DoubleMap scoresMap = getScoresMap(uidx); final IntDoubleTopN topN = new IntDoubleTopN(min(maxLength, scoresMap.size())); scoresMap.int2DoubleEntrySet().forEach(e -> { int iidx = e.getIntKey(); double score = e.getDoubleValue(); if (filter.test(iidx)) { topN.add(iidx, score); } }); topN.sort(); List<Tuple2id> items = topN.reverseStream() .collect(toList()); return new FastRecommendation(uidx, items); }