@Override protected Table<String, Integer, Character> create(Object... data) { Supplier<TreeMap<Integer, Character>> factory = new Supplier<TreeMap<Integer, Character>>() { @Override public TreeMap<Integer, Character> get() { return Maps.newTreeMap(); } }; Map<String, Map<Integer, Character>> backingMap = Maps.newLinkedHashMap(); Table<String, Integer, Character> table = Tables.newCustomTable(backingMap, factory); populate(table, data); return table; }
/** * create table which consist of {@link LinkedHashMap} factory. * @return table */ private Table<Locale, String, String> createTable() { Map<Locale, Map<String, String>> backingMap = Maps.newLinkedHashMap(); Table<Locale, String, String> table = Tables.newCustomTable(backingMap, LINKED_HASH_MAP_SUPPLIER); return table; }
/** * @param predicate <code>null</code> for always <code>true</code>. */ public FloatMatrixBase(Predicate<Double> predicate) { // m_table = HashBasedTable.create(); // m_table = TreeBasedTable.create(m_rowsComparator, m_columnsComparator); final TreeMap<R, Map<C, Double>> rowMap = Maps.newTreeMap(m_rowsComparator); m_table = Tables.newCustomTable(rowMap, new Supplier<Map<C, Double>>() { @Override public Map<C, Double> get() { final TreeMap<C, Double> map = Maps.newTreeMap(m_columnsComparator); Maps.filterValues(map, m_valuePredicate); return map; } }); m_valuePredicate = predicate; }
/** * Create a new empty graph. */ public TableGraph() { data = Tables.newCustomTable( new LinkedHashMap<Point, Map<Point, Connection<E>>>(), new LinkedHashMapFactory<Connection<E>>()); }
/** * Create a new empty graph. */ public TableGraph() { data = Tables.newCustomTable( new LinkedHashMap<Point, Map<Point, Connection<E>>>(), new LinkedHashMapFactory<Connection<E>>()); }
public static <R, C, V> Table<R, C, V> createTable(boolean rowIdentity, boolean columnIdentity) { Map<R, Map<C, V>> backingMap = createMap(rowIdentity); Supplier<Map<C, V>> supplier = columnIdentity ? IdentityHashMap::new : LinkedHashMap::new; Table<R, C, V> result = Tables.newCustomTable(backingMap, supplier::get); return result; }
/** * Instantiates a new graph using the specified multimap. * @param map The multimap that is copied into this new graph. */ public MultimapGraph(Multimap<Point, Point> map) { multimap = LinkedHashMultimap.create(map); lazyConnectionTable = Tables.newCustomTable( new LinkedHashMap<Point, Map<Point, Connection<E>>>(), new LinkedHashMapFactory<Connection<E>>()); deadEndNodes = new HashSet<>(); deadEndNodes.addAll(multimap.values()); deadEndNodes.removeAll(multimap.keySet()); }
/** * Instantiates a new graph using the specified multimap. * @param map The multimap that is copied into this new graph. */ public MultimapGraph(Multimap<Point, Point> map) { multimap = LinkedHashMultimap.create(map); lazyConnectionTable = Tables.newCustomTable( new LinkedHashMap<Point, Map<Point, Connection<E>>>(), new LinkedHashMapFactory<Connection<E>>()); deadEndNodes = new HashSet<>(); deadEndNodes.addAll(multimap.values()); deadEndNodes.removeAll(multimap.keySet()); }
protected Table<Integer, Comparable, Object> createNullableTable() { return Tables.newCustomTable( Maps.<Integer, Map<Comparable, Object>>newLinkedHashMap(), new Supplier<Map<Comparable, Object>>() { public Map<Comparable, Object> get() { return Maps.newLinkedHashMap(); } } ); }
/** * Create a new graph with initial data. * @param table The table that is copied into the graph. */ public TableGraph(Table<Point, Point, Connection<E>> table) { data = Tables.newCustomTable( new LinkedHashMap<Point, Map<Point, Connection<E>>>(), new LinkedHashMapFactory<Connection<E>>()); data.putAll(table); }
/** * Create a new graph with initial data. * @param table The table that is copied into the graph. */ public TableGraph(Table<Point, Point, Connection<E>> table) { data = Tables.newCustomTable( new LinkedHashMap<Point, Map<Point, Connection<E>>>(), new LinkedHashMapFactory<Connection<E>>()); data.putAll(table); }
this.moduleClasses = Tables.newCustomTable(backingMap, new Supplier<Map<DatasetModuleId, String>>() { @Override public Map<DatasetModuleId, String> get() {
this.moduleClasses = Tables.newCustomTable(backingMap, new Supplier<Map<DatasetModuleId, String>>() { @Override public Map<DatasetModuleId, String> get() {
@Override protected Table<String, Integer, Character> create( Object... data) { Supplier<TreeMap<Integer, Character>> factory = new Supplier<TreeMap<Integer, Character>>() { @Override public TreeMap<Integer, Character> get() { return Maps.newTreeMap(); } }; Map<String, Map<Integer, Character>> backingMap = Maps.newLinkedHashMap(); Table<String, Integer, Character> table = Tables.newCustomTable(backingMap, factory); populate(table, data); return table; }