]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/map/HashMapUtils.java
TransferableGraphUtils.getObjects2 for fixing not-found handling
[simantics/platform.git] / bundles / org.simantics.scl.osgi / src / org / simantics / scl / osgi / map / HashMapUtils.java
1 package org.simantics.scl.osgi.map;
2
3 import gnu.trove.map.hash.THashMap;
4 import gnu.trove.procedure.TObjectObjectProcedure;
5
6 import java.util.ArrayList;
7 import java.util.List;
8
9 import org.simantics.scl.runtime.tuple.Tuple2;
10
11 public class HashMapUtils {
12
13     public static List entries(THashMap map) {
14         final ArrayList result = new ArrayList(map.size());
15         map.forEachEntry(new TObjectObjectProcedure<Object, Object>() {
16
17             @Override
18             public boolean execute(Object a, Object b) {
19                 result.add(new Tuple2(a, b));
20                 return true;
21             }
22         });
23         return result;
24     }
25     
26 }