当前位置: 首页>>代码示例>>Java>>正文


Java AbstractSet类代码示例

本文整理汇总了Java中java.util.AbstractSet的典型用法代码示例。如果您正苦于以下问题:Java AbstractSet类的具体用法?Java AbstractSet怎么用?Java AbstractSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbstractSet类属于java.util包,在下文中一共展示了AbstractSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public Set<Map.Entry<NameAndAccess, TMember>> entrySet() {
	return new AbstractSet<Map.Entry<NameAndAccess, TMember>>() {
		@Override
		public Iterator<Map.Entry<NameAndAccess, TMember>> iterator() {
			return Iterators.unmodifiableIterator(
					new TransformedIterator2<TMember, Map.Entry<NameAndAccess, TMember>>(members.iterator()) {
						@Override
						protected Map.Entry<NameAndAccess, TMember> transform(TMember input) {
							final NameAndAccess[] nameAndAccess = NameAndAccess.of(input);
							if (nameAndAccess.length > 1) {
								setAdditionalElement(new AbstractMap.SimpleImmutableEntry<>(nameAndAccess[1], input));
							}
							return new AbstractMap.SimpleImmutableEntry<>(nameAndAccess[0], input);
						}
					});
		}

		@Override
		public int size() {
			return members.size();
		}
	};
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:MemberByNameAndAccessMap.java

示例2: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public Set<Entry<Range<K>, V>> entrySet() {
  return new AbstractSet<Entry<Range<K>, V>>() {

    @SuppressWarnings("unchecked") // it's safe to upcast iterators
    @Override
    public Iterator<Entry<Range<K>, V>> iterator() {
      return (Iterator) entriesByLowerBound.values().iterator();
    }

    @Override
    public int size() {
      return entriesByLowerBound.size();
    }
  };
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:TreeRangeMap.java

示例3: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public Set<Map.Entry<K, V>> entrySet() {
    return new AbstractSet<Map.Entry<K, V>>() {

        @Override
        public Iterator<java.util.Map.Entry<K, V>> iterator() {
            return new EntryIterator<>(root);
        }

        @Override
        public boolean contains(Object o) {
            if (o == null || !(o instanceof Map.Entry)) {
                return false;
            }
            Map.Entry<?, ?> entry = (java.util.Map.Entry<?, ?>) o;
            return entry.getValue().equals(CopyOnWriteHashMap.this.get(entry.getKey()));
        }

        @Override
        public int size() {
            return CopyOnWriteHashMap.this.size();
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:CopyOnWriteHashMap.java

示例4: broadcast

import java.util.AbstractSet; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public final Set<WriteFuture> broadcast(Object message) {
    // Convert to Set.  We do not return a List here because only the
    // direct caller of MessageBroadcaster knows the order of write
    // operations.
    final List<WriteFuture> futures = IoUtil.broadcast(message, getManagedSessions().values());
    return new AbstractSet<WriteFuture>() {
        @Override
        public Iterator<WriteFuture> iterator() {
            return futures.iterator();
        }

        @Override
        public int size() {
            return futures.size();
        }
    };
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:AbstractIoService.java

示例5: commandRun

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public void commandRun() {
    if (zkServer == null) {
        pw.println(ZK_NOT_SERVING);
    } else {
        // clone should be faster than iteration
        // ie give up the cnxns lock faster
        AbstractSet<ServerCnxn> cnxns;
        synchronized (factory.cnxns) {
            cnxns = new HashSet<ServerCnxn>(factory.cnxns);
        }
        for (ServerCnxn c : cnxns) {
            c.dumpConnectionInfo(pw, false);
            pw.println();
        }
        pw.println();
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:19,代码来源:NettyServerCnxn.java

示例6: keySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public Set<K> keySet()
{
   return new AbstractSet()
   {
      @Override
      public Iterator iterator()
      {
         return iterableKeys.iterator();
      }

      @Override
      public int size()
      {
         return iterableKeys.size();
      }
   };
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:19,代码来源:SortedMap.java

示例7: asHashSet

import java.util.AbstractSet; //导入依赖的package包/类
/**
 * Returns a set backed by the given array (i.e. a set that uses object
 * equality for comparisons). The array must contain no duplicates, its
 * elements must be sorted in the increasing order of hashcodes (as by
 * {@link #hashSort(Object[])}), and its contents must not be changed while
 * it is in use by the returned set.
 * 
 * @requires all i, j: [0..array.length) | i < j => array[i].hashCode() <=
 *           array[j].hashCode
 * @return an unmodifiable Set view of the given array
 */
public static final <T> Set<T> asHashSet(final T[] array) {
	return new AbstractSet<T>() {
		public boolean contains(Object o) {
			return hashBinarySearch(array, o) >= 0;
		}

		public Iterator<T> iterator() {
			return iterate(array);
		}

		public int size() {
			return array.length;
		}
	};
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:27,代码来源:Containers.java

示例8: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public Set<Entry<String, Object>> entrySet() {
    return new AbstractSet<Entry<String,Object>>() {
        @Override
        public boolean add(Entry<String, Object> e) {
            String key = e.getKey();
            Object value = e.getValue();

            original.put(key, unwrapIncoming(value));
            return true;
        }

        @Override
        public int size() {
            return original.size();
        }

        @Override
        public Iterator<Entry<String, Object>> iterator() {
            return ConvertedMap.this.iterator();
        }
    };
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:24,代码来源:NbtFactory.java

示例9: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public Set<Map.Entry<Boolean, T>> entrySet() {
    return new AbstractSet<Map.Entry<Boolean, T>>() {
        @Override
        public Iterator<Map.Entry<Boolean, T>> iterator() {
            Map.Entry<Boolean, T> falseEntry = new SimpleImmutableEntry<>(false, forFalse);
            Map.Entry<Boolean, T> trueEntry = new SimpleImmutableEntry<>(true, forTrue);
            return Arrays.asList(falseEntry, trueEntry).iterator();
        }

        @Override
        public int size() {
            return 2;
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:Collectors.java

示例10: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
public Set<Map.Entry<K, V>> entrySet() {
    return new AbstractSet<Map.Entry<K, V>>() {
        public int size() {
            return map.size();
        }

        public Iterator<Map.Entry<K,V>> iterator() {
            final Iterator<Map.Entry<K,V>> source = map.entrySet().iterator();
            return new Iterator<Map.Entry<K,V>>() {
               public boolean hasNext() { return source.hasNext(); }
               public Map.Entry<K,V> next() { return source.next(); }
               public void remove() { source.remove(); }
            };
        }

        public boolean add(Map.Entry<K,V> e) {
            return map.entrySet().add(e);
        }
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:Defaults.java

示例11: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
@SuppressWarnings ("unchecked")
public Set<java.util.Map.Entry<K, V>> entrySet() {
    if (entries == null) {
        entries = new AbstractSet<Entry<K, V>>() {
            @Override
            public void clear() {
                throw new UnsupportedOperationException();
            }

            @Override
            public Iterator<Entry<K, V>> iterator() {
                return list.iterator();
            }

            @Override
            public int size() {
                return list.size();
            }
        };
    }
    return (Set<java.util.Map.Entry<K, V>>) entries;
}
 
开发者ID:NovaStory,项目名称:AeroStory,代码行数:24,代码来源:ArrayMap.java

示例12: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public Set<Map.Entry<Boolean, T>> entrySet() {
    return new AbstractSet<>() {
        @Override
        public Iterator<Map.Entry<Boolean, T>> iterator() {
            Map.Entry<Boolean, T> falseEntry = new SimpleImmutableEntry<>(false, forFalse);
            Map.Entry<Boolean, T> trueEntry = new SimpleImmutableEntry<>(true, forTrue);
            return List.of(falseEntry, trueEntry).iterator();
        }

        @Override
        public int size() {
            return 2;
        }
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Collectors.java

示例13: entrySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override public Set<Map.Entry<K,V>> entrySet() {
    return new AbstractSet<Map.Entry<K,V>>() {
        @Override public int size() {
            return map.size();
        }

        @Override public Iterator<Map.Entry<K,V>> iterator() {
            final Iterator<Map.Entry<K,V>> source = map.entrySet().iterator();
            return new Iterator<Map.Entry<K,V>>() {
               public boolean hasNext() { return source.hasNext(); }
               public Map.Entry<K,V> next() { return source.next(); }
               public void remove() { source.remove(); }
            };
        }

        @Override public boolean add(Map.Entry<K,V> e) {
            return map.entrySet().add(e);
        }
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Defaults.java

示例14: keySet

import java.util.AbstractSet; //导入依赖的package包/类
@Override synchronized public Set<K> keySet() {
    return new AbstractSet<K>() {

        @Override public int size() {
            return OidEntityDtoMap.this.size();
        }

        @Override public boolean contains(Object o) {
            return OidEntityDtoMap.this.containsKey(o);
        }

        @Override public Iterator<K> iterator() {
            return OidEntityDtoMap.this.keys_.iterator();
        }
    };
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:17,代码来源:OidEntityDtoMap.java

示例15: commandRun

import java.util.AbstractSet; //导入依赖的package包/类
@Override
public void commandRun() {
    if (!isZKServerRunning()) {
        pw.println(ZK_NOT_SERVING);
    } else {
        // clone should be faster than iteration
        // ie give up the cnxns lock faster
        AbstractSet<ServerCnxn> cnxns;
        synchronized (factory.cnxns) {
            cnxns = new HashSet<ServerCnxn>(factory.cnxns);
        }
        for (ServerCnxn c : cnxns) {
            c.dumpConnectionInfo(pw, false);
            pw.println();
        }
        pw.println();
    }
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:19,代码来源:NettyServerCnxn.java


注:本文中的java.util.AbstractSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。