gitlab #376
Change-Id: Ic96633256050766e385ea27816684e97cf0068c2
org.simantics.utils;bundle-version="1.0.0",
gnu.trove3;bundle-version="3.0.0",
org.simantics.databoard;bundle-version="0.6.5";resolution:=optional,
org.simantics.utils;bundle-version="1.0.0",
gnu.trove3;bundle-version="3.0.0",
org.simantics.databoard;bundle-version="0.6.5";resolution:=optional,
- org.slf4j.api;bundle-version="1.7.25"
+ org.slf4j.api;bundle-version="1.7.25",
+ org.eclipse.collections.eclipse-collections;bundle-version="9.2.0",
+ org.eclipse.collections.eclipse-collections-api;bundle-version="9.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: org.simantics.utils.datastructures
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: org.simantics.utils.datastructures
*/
package org.simantics.utils.datastructures;
*/
package org.simantics.utils.datastructures;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.eclipse.collections.impl.factory.Lists;
+import org.eclipse.collections.impl.factory.Maps;
+
/**
* MapList is a data structure with map on left side and arraylist on right side.
* <p>
/**
* MapList is a data structure with map on left side and arraylist on right side.
* <p>
protected Map<L, List<R>> lists;
public MapList() {
protected Map<L, List<R>> lists;
public MapList() {
- lists = new HashMap<L, List<R>>();
- }
-
- @SuppressWarnings("unchecked")
- public MapList( Class<?> mapClass ) {
- try {
- lists = (Map<L, List<R>>) mapClass.newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException( e );
- } catch (IllegalAccessException e) {
- throw new RuntimeException( e );
- }
+ lists = Maps.mutable.empty();
}
public MapList(MapList<L, R> copyFrom) {
for (Entry<L, List<R>> e : copyFrom.lists.entrySet())
}
public MapList(MapList<L, R> copyFrom) {
for (Entry<L, List<R>> e : copyFrom.lists.entrySet())
- lists.put( e.getKey(), new ArrayList<R>(e.getValue()) );
+ lists.put( e.getKey(), Lists.mutable.withAll(e.getValue()) );
}
public static <L, R> MapList<L, R> use( Map<L, List<R>> map ) {
}
public static <L, R> MapList<L, R> use( Map<L, List<R>> map ) {
public void add(L key, int index, R value)
{
public void add(L key, int index, R value)
{
- ArrayList<R> list = getOrCreateList(key);
+ List<R> list = getOrCreateList(key);
list.add(index, value);
}
public void addAll(L key, Collection<R> values) {
list.add(index, value);
}
public void addAll(L key, Collection<R> values) {
- ArrayList<R> list = getOrCreateList(key);
+ List<R> list = getOrCreateList(key);
- private ArrayList<R> getOrCreateList(L key)
+ private List<R> getOrCreateList(L key)
- ArrayList<R> list = (ArrayList<R>) lists.get(key);
+ List<R> list = lists.get(key);
- list = new ArrayList<R>(1);
+ list = Lists.mutable.withInitialCapacity(1);
lists.put(key, list);
}
return list;
lists.put(key, list);
}
return list;
{
List<R> l = lists.get(key);
if (l==null) return Collections.emptyList();
{
List<R> l = lists.get(key);
if (l==null) return Collections.emptyList();
- return new ArrayList<R>(l);
+ return Lists.mutable.withAll(l);
}
public List<R> getAllValuesSnapshot()
}
public List<R> getAllValuesSnapshot()
public List<R> getAllValuesSnapshot(List<R> result)
{
if (result == null)
public List<R> getAllValuesSnapshot(List<R> result)
{
if (result == null)
- result = new ArrayList<R>();
+ result = Lists.mutable.empty();
for (List<R> right : lists.values()) {
result.addAll(right);
}
for (List<R> right : lists.values()) {
result.addAll(right);
}
/**
* Makes _this_ maplist immutable.
*/
/**
* Makes _this_ maplist immutable.
*/
+ @SuppressWarnings("unchecked")
public void makeImmutable() {
for (Entry<L, List<R>> e : lists.entrySet())
public void makeImmutable() {
for (Entry<L, List<R>> e : lists.entrySet())
- lists.put(e.getKey(), Collections.unmodifiableList(e.getValue()));
- lists = Collections.unmodifiableMap(lists);
+ lists.put(e.getKey(), (List<R>) Lists.immutable.withAll(e.getValue()));
+ lists = (Map<L, List<R>>) Maps.immutable.withAll(lists);
*/
package org.simantics.utils.datastructures.hints;
*/
package org.simantics.utils.datastructures.hints;
-import gnu.trove.map.hash.THashMap;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.collections.impl.factory.Maps;
*/
public class HintContext extends AbstractHintObservable implements IHintContext, Cloneable {
*/
public class HintContext extends AbstractHintObservable implements IHintContext, Cloneable {
- protected Map<Key, Object> hints = new THashMap<Key, Object>();
+ protected Map<Key, Object> hints = Maps.mutable.empty();
@Override
public void clearWithoutNotification() {
@Override
public void clearWithoutNotification() {
version="0.0.0"
unpack="false"/>
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.collections.eclipse-collections"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.collections.eclipse-collections-api"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+