Search in sources :

Example 1 with UnifiedMap

use of org.eclipse.collections.impl.map.mutable.UnifiedMap in project eclipse-collections by eclipse.

the class ImmutableUnifiedMapTest method newWith.

@Override
public final <T> ImmutableMap<Object, T> newWith(T... elements) {
    Random random = new Random(CURRENT_TIME_MILLIS);
    MutableMap<Object, T> result = new UnifiedMap<>();
    for (T each : elements) {
        assertNull(result.put(random.nextDouble(), each));
    }
    return result.toImmutable();
}
Also used : Random(java.util.Random) UnifiedMap(org.eclipse.collections.impl.map.mutable.UnifiedMap)

Example 2 with UnifiedMap

use of org.eclipse.collections.impl.map.mutable.UnifiedMap in project eclipse-collections by eclipse.

the class SynchronizedMutableMapTest method newWith.

@Override
public <T> MutableMap<Object, T> newWith(T... elements) {
    Random random = new Random(CURRENT_TIME_MILLIS);
    MutableMap<Object, T> result = new UnifiedMap<>();
    for (T each : elements) {
        assertNull(result.put(random.nextDouble(), each));
    }
    return SynchronizedMutableMap.of(result);
}
Also used : Random(java.util.Random) UnifiedMap(org.eclipse.collections.impl.map.mutable.UnifiedMap)

Example 3 with UnifiedMap

use of org.eclipse.collections.impl.map.mutable.UnifiedMap in project eclipse-collections by eclipse.

the class UnmodifiableMutableMapTest method newWith.

@Override
public <T> MutableMap<Object, T> newWith(T... elements) {
    Random random = new Random(CURRENT_TIME_MILLIS);
    MutableMap<Object, T> result = new UnifiedMap<>();
    for (T each : elements) {
        assertNull(result.put(random.nextDouble(), each));
    }
    return UnmodifiableMutableMap.of(result);
}
Also used : Random(java.util.Random) UnifiedMap(org.eclipse.collections.impl.map.mutable.UnifiedMap)

Example 4 with UnifiedMap

use of org.eclipse.collections.impl.map.mutable.UnifiedMap in project eclipse-collections by eclipse.

the class UnifiedMapKeySetTest method newWith.

@SafeVarargs
@Override
public final <T> Set<T> newWith(T... elements) {
    Random random = new Random(CURRENT_TIME_MILLIS);
    MutableMap<T, Double> result = new UnifiedMap<>();
    for (T element : elements) {
        assertNull(result.put(element, random.nextDouble()));
    }
    return result.keySet();
}
Also used : Random(java.util.Random) UnifiedMap(org.eclipse.collections.impl.map.mutable.UnifiedMap)

Example 5 with UnifiedMap

use of org.eclipse.collections.impl.map.mutable.UnifiedMap in project robozonky by RoboZonky.

the class AbstractEmailingListener method getData.

protected Map<String, Object> getData(final T event) {
    final Map<String, Object> result = new UnifiedMap<>(getBaseData(event));
    if (event instanceof Financial) {
        final PortfolioOverview portfolioOverview = ((Financial) event).getPortfolioOverview();
        result.put("portfolio", Util.summarizePortfolioStructure(portfolioOverview));
    }
    return result;
}
Also used : UnifiedMap(org.eclipse.collections.impl.map.mutable.UnifiedMap) Financial(com.github.robozonky.api.notifications.Financial) PortfolioOverview(com.github.robozonky.api.strategies.PortfolioOverview)

Aggregations

UnifiedMap (org.eclipse.collections.impl.map.mutable.UnifiedMap)8 Random (java.util.Random)5 Map (java.util.Map)2 NumberTerm (alice.tuprolog.NumberTerm)1 Struct (alice.tuprolog.Struct)1 Theory (alice.tuprolog.Theory)1 Var (alice.tuprolog.Var)1 Financial (com.github.robozonky.api.notifications.Financial)1 PortfolioOverview (com.github.robozonky.api.strategies.PortfolioOverview)1 Iterables (com.google.common.collect.Iterables)1 List (java.util.List)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 TODO (jcog.TODO)1 Util (jcog.Util)1 FasterList (jcog.list.FasterList)1 nars.$ (nars.$)1 Op (nars.Op)1 CONJ (nars.Op.CONJ)1 Term (nars.term.Term)1