Java Code Examples for

The following examples show how to use These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: NBANDROID-V2   Source File:    License: Apache License 2.0 5 votes vote down vote up
public Table<ResourceNamespace, ResourceType, ResourceValueMap> getConfiguredResources(
        @NonNull FolderConfiguration referenceConfig) {
    synchronized (ITEM_MAP_LOCK) {
        Set<ResourceNamespace> namespaces = getNamespaces();

        Map<ResourceNamespace, Map<ResourceType, ResourceValueMap>> backingMap;
        if (KnownNamespacesMap.canContainAll(namespaces)) {
            backingMap = new KnownNamespacesMap<>();
        } else {
            backingMap = new HashMap<>();
        Table<ResourceNamespace, ResourceType, ResourceValueMap> table
                = Tables.newCustomTable(backingMap, () -> new EnumMap<>(ResourceType.class));

        for (ResourceNamespace namespace : namespaces) {
            // TODO(namespaces): Move this method to ResourceResolverCache.
            // For performance reasons don't mix framework and non-framework resources since
            // they have different life spans.

            for (ResourceType type : ResourceType.values()) {
                // get the local results and put them in the map
                        getConfiguredResources(namespace, type, referenceConfig));
        return table;
Example 2
Source Project: ProjectAres   Source File:    License: GNU Affero General Public License v3.0 4 votes vote down vote up
public Set<Cell<R, C, V>> cellSet() {
    return new AbstractSet<Cell<R, C, V>>() {
        public int size() {
            return TableView.this.size();

        public boolean isEmpty() {
            return TableView.this.isEmpty();

        public boolean contains(Object o) {
            if(!(o instanceof Cell)) return false;
            final Cell cell = (Cell) o;
            return Objects.equals(get(cell.getRowKey(), cell.getColumnKey()), cell.getValue());

        public Stream<Cell<R, C, V>> stream() {
            return map.entrySet()
                      .flatMap(row -> row.getValue()
                                         .map(col -> Tables.immutableCell(row.getKey(),

        public Spliterator<Cell<R, C, V>> spliterator() {
            return stream().spliterator();

        public Iterator<Cell<R, C, V>> iterator() {
            return Spliterators.iterator(spliterator());
Example 3
public Table<Integer, String, Object> load(InlineTable inlineTable){
	return Tables.unmodifiableTable(parse(inlineTable));
Example 4
Source Project: batfish   Source File:    License: Apache License 2.0 2 votes vote down vote up
 * Returns an immutable copy of the input table that has been materialized in transposed form.
 * <p>Use this instead of {@link Tables#transpose(Table)} if the result will be iterated on in
 * row-major order. Transposing the table alone does not change the row-major vs column-major
 * internal representation so the performance of row-oriented operations is abysmal. Instead, we
 * need to actually materialize the transposed representation.
public static <R, C, V> Table<C, R, V> transposeAndMaterialize(Table<R, C, V> edgeTable) {
  return ImmutableTable.copyOf(Tables.transpose(edgeTable));