类java.util.Set源码实例Demo

下面列出了怎么用java.util.Set的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: portals-pluto   文件: WebContextProducer.java
public CDIPortletWebContext(BeanManager beanManager, VariableValidator variableInspector, Models models,
	String lifecyclePhase, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
	ServletContext servletContext, Locale locale) {

	super(httpServletRequest, httpServletResponse, servletContext, locale);
	this.beanManager = beanManager;
	this.models = models;
	this.beanNames = new HashSet<>();

	boolean headerPhase = lifecyclePhase.equals(PortletRequest.HEADER_PHASE);
	boolean renderPhase = lifecyclePhase.equals(PortletRequest.RENDER_PHASE);
	boolean resourcePhase = lifecyclePhase.equals(PortletRequest.RESOURCE_PHASE);

	Set<Bean<?>> beans = beanManager.getBeans(Object.class, new AnnotationLiteral<Any>() {
			});

	for (Bean<?> bean : beans) {
		String beanName = bean.getName();

		if ((beanName != null) &&
				variableInspector.isValidName(beanName, headerPhase, renderPhase, resourcePhase)) {
			this.beanNames.add(beanName);
		}
	}
}
 
@Test
// @T gmt> 10,2,5 +一段时间 gmt< 10,2,6号中一个时间的
public void test39() throws Exception {

    btc = gand(gcomp(getDate(110, 02, 5, 0, 0, 1), GreaterThan),
        gcomp(getDate(110, 02, 6, 23, 59, 59), TestUtils.LessThanOrEqual));
    Set<Object> s = e.getEnumeratedValue(btc, 7, 1, needMergeValueInCloseRange);
    TestUtils.testSetDate(new Date[] { getDate(110, 02, 5, 0, 0, 1), getDate(110, 02, 6, 0, 0, 1),
            getDate(110, 02, 6, 23, 59, 59) },
        s);

    s = e.getEnumeratedValue(btc, 7, 1, needMergeValueInCloseRange);
    TestUtils.testSetDate(new Date[] { getDate(110, 02, 5, 0, 0, 1), getDate(110, 02, 6, 0, 0, 1),
            getDate(110, 02, 6, 23, 59, 59) },
        s);
}
 
源代码3 项目: pcgen   文件: AbstractQualifiedListFacetTest.java
@Test
public void testTypeAddAllNullInList()
{
	T t1 = getObject();
	T t2 = getObject();
	List<T> pct = new ArrayList<>();
	pct.add(t1);
	pct.add(null);
	pct.add(t2);
	Object source1 = new Object();
	assertThrows(NullPointerException.class,
			() -> getFacet().addAll(id, pct, source1)
	);
	/*
	 * TODO This should be zero, one or two???
	 */
	assertEquals(1, getFacet().getCount(id));
	assertFalse(getFacet().isEmpty(id));
	Set<T> setoftwo = getFacet().getSet(id);
	assertNotNull(setoftwo);
	assertEquals(1, setoftwo.size());
	assertTrue(setoftwo.contains(t1));
	assertEventCount(1, 0);
}
 
源代码4 项目: MyVirtualDirectory   文件: SchemaInterceptor.java
/**
 * Checks to see if an attribute is required by as determined from an entry's
 * set of objectClass attribute values.
 *
 * @return true if the objectClass values require the attribute, false otherwise
 * @throws Exception if the attribute is not recognized
 */
private void assertAllAttributesAllowed( Dn dn, Entry entry, Set<String> allowed ) throws LdapException
{
    // Never check the attributes if the extensibleObject objectClass is
    // declared for this entry
    Attribute objectClass = entry.get( OBJECT_CLASS_AT );

    if ( objectClass.contains( SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
    {
        return;
    }

    for ( Attribute attribute : entry )
    {
        String attrOid = attribute.getAttributeType().getOid();

        AttributeType attributeType = attribute.getAttributeType();

        if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS )
            && !allowed.contains( attrOid ) )
        {
            throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_277,
                attribute.getUpId(), dn.getName() ) );
        }
    }
}
 
@Test
public void testClassListsAreComplete() throws Exception {
    // Use reflection to get hold of the internal Map
    Class<?> clazz = ImportHandler.class;
    Field f = clazz.getDeclaredField("standardPackages");
    f.setAccessible(true);
    Object obj = f.get(null);

    Assert.assertTrue("Not Map", obj instanceof Map);

    @SuppressWarnings("unchecked")
    Map<String,Set<String>> standardPackageName = (Map<String, Set<String>>) obj;

    for (Map.Entry<String,Set<String>> entry : standardPackageName.entrySet()) {
        checkPackageClassList(entry.getKey(), entry.getValue());
    }
}
 
源代码6 项目: netbeans   文件: WebKitBreakpointManager.java
@Override
public void add() {
    Set<String> events = eb.getEvents();
    bps = new HashMap<String, org.netbeans.modules.web.webkit.debugging.api.debugger.Breakpoint>(events.size());
    for (String event : events) {
        org.netbeans.modules.web.webkit.debugging.api.debugger.Breakpoint b;
        if (eb.isInstrumentationEvent(event)) {
            b = d.addInstrumentationBreakpoint(event);
        } else {
            b = d.addEventBreakpoint(event);
        }
        if (b != null) {
            bps.put(event, b);
        }
    }
    
}
 
private static String getCurrentSubjectName() {
	final AccessControlContext acc = AccessController.getContext();

	return AccessController.doPrivileged(new PrivilegedAction<String>() {

		@Override
		public String run() {
			Subject subject = Subject.getSubject(acc);
			if (subject == null) {
				return null;
			}

			Set<Principal> principals = subject.getPrincipals();

			if (principals == null) {
				return null;
			}
			for (Principal p : principals) {
				return p.getName();
			}
			return null;
		}
	});
}
 
源代码8 项目: pentaho-kettle   文件: SetValueFieldDialog.java
protected void setComboBoxes() {
  // Something was changed in the row.
  //
  final Map<String, Integer> fields = new HashMap<String, Integer>();

  // Add the currentMeta fields...
  fields.putAll( inputFields );

  Set<String> keySet = fields.keySet();
  List<String> entries = new ArrayList<String>( keySet );

  String[] fieldNames = entries.toArray( new String[entries.size()] );

  Const.sortStrings( fieldNames );
  colinf[0].setComboValues( fieldNames );
  colinf[1].setComboValues( fieldNames );
}
 
源代码9 项目: ndbc   文件: Config.java
private Config(final String dataSourceSupplierClass, final String host, final int port, final String user,
    final Charset charset, final ScheduledExecutorService scheduler, final Optional<String> password,
    final Optional<String> database, final Optional<Integer> poolMaxSize, final Optional<Integer> poolMaxWaiters,
    final Optional<Duration> connectionTimeout, final Optional<Duration> queryTimeout,
    final Optional<Duration> poolValidationInterval, final Optional<Set<String>> encodingClasses,
    final Optional<Integer> nioThreads, final Optional<SSL> ssl, final Optional<Embedded> embeddedDatabase) {
  this.dataSourceSupplierClass = dataSourceSupplierClass;
  this.charset = charset;
  this.scheduler = scheduler;
  this.user = user;
  this.password = password;
  this.database = database;
  this.host = host;
  this.port = port;
  this.poolMaxSize = poolMaxSize;
  this.poolMaxWaiters = poolMaxWaiters;
  this.connectionTimeout = connectionTimeout;
  this.queryTimeout = queryTimeout;
  this.poolValidationInterval = poolValidationInterval;
  this.encodingClasses = encodingClasses.map(Collections::unmodifiableSet);
  this.nioThreads = nioThreads;
  this.ssl = ssl;
  this.embedded = embeddedDatabase;
}
 
源代码10 项目: openjdk-8   文件: Bind.java
SctpChannel connectChannel(SctpChannel channel)
    throws IOException {
    debug("connecting channel...");
    try {
        SctpServerChannel ssc = SctpServerChannel.open();
        ssc.bind(null);
        Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
        Iterator<SocketAddress> iterator = addrs.iterator();
        SocketAddress addr = iterator.next();
        debug("using " + addr + "...");
        channel.connect(addr);
        SctpChannel peerChannel = ssc.accept();
        ssc.close();
        debug("connected");
        return peerChannel;
    } catch (IOException ioe) {
        debug("Cannot connect channel");
        unexpected(ioe);
        throw ioe;
    }
}
 
源代码11 项目: apiman   文件: JpaStorage.java
/**
 * @see io.apiman.manager.api.core.IStorageQuery#getUserMemberships(java.lang.String, java.lang.String)
 */
@Override
public Set<RoleMembershipBean> getUserMemberships(String userId, String organizationId) throws StorageException {
    Set<RoleMembershipBean> memberships = new HashSet<>();
    beginTx();
    try {
        EntityManager entityManager = getActiveEntityManager();
        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
        CriteriaQuery<RoleMembershipBean> criteriaQuery = builder.createQuery(RoleMembershipBean.class);
        Root<RoleMembershipBean> from = criteriaQuery.from(RoleMembershipBean.class);
        criteriaQuery.where(
                builder.equal(from.get("userId"), userId),
                builder.equal(from.get("organizationId"), organizationId) );
        TypedQuery<RoleMembershipBean> typedQuery = entityManager.createQuery(criteriaQuery);
        List<RoleMembershipBean> resultList = typedQuery.getResultList();
        memberships.addAll(resultList);
        return memberships;
    } catch (Throwable t) {
        logger.error(t.getMessage(), t);
        throw new StorageException(t);
    } finally {
        rollbackTx();
    }
}
 
private Set<String> getJcloudsLocationIds(final Collection<? extends String> jcloudsApiIds) {
    Set<String> openstackNovaProviders = FluentIterable.from(Providers.all())
            .filter(new Predicate<ProviderMetadata>() {
        @Override
        public boolean apply(ProviderMetadata providerMetadata) {
            return jcloudsApiIds.contains(providerMetadata.getApiMetadata().getId());
        }
    }).transform(new Function<ProviderMetadata, String>() {
        @Nullable
        @Override
        public String apply(ProviderMetadata input) {
            return input.getId();
        }
    }).toSet();

    return new ImmutableSet.Builder<String>()
            .addAll(openstackNovaProviders)
            .addAll(jcloudsApiIds)
            .build();
}
 
源代码13 项目: javaide   文件: Project.java
/**
 * Returns the transitive closure of the library projects for this project
 *
 * @return the transitive closure of the library projects for this project
 */
@NonNull
public List<Project> getAllLibraries() {
    if (mAllLibraries == null) {
        if (mDirectLibraries.isEmpty()) {
            return mDirectLibraries;
        }

        List<Project> all = new ArrayList<Project>();
        Set<Project> seen = Sets.newHashSet();
        Set<Project> path = Sets.newHashSet();
        seen.add(this);
        path.add(this);
        addLibraryProjects(all, seen, path);
        mAllLibraries = all;
    }

    return mAllLibraries;
}
 
@Override
public Set<String> setServletSecurity(ServletSecurityElement constraint) {
    if (constraint == null) {
        throw new IllegalArgumentException(sm.getString(
                "applicationServletRegistration.setServletSecurity.iae",
                getName(), context.getName()));
    }

    if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
        throw new IllegalStateException(sm.getString(
                "applicationServletRegistration.setServletSecurity.ise",
                getName(), context.getName()));
    }

    this.constraint = constraint;
    return context.addServletSecurity(this, constraint);
}
 
源代码15 项目: nano-framework   文件: PluginLoader.java
private void initModules() throws Throwable {
    final Set<String> moduleNames = SPILoader.spiNames(Module.class);
    if (!CollectionUtils.isEmpty(moduleNames)) {
        final Injector injector = Globals.get(Injector.class);
        final Map<Integer, List<Module>> modules = Maps.newHashMap();
        for (final String moduleName : moduleNames) {
            final Module module = injector.getInstance(Key.get(Module.class, Names.named(moduleName)));
            final Level level = module.getClass().getAnnotation(Level.class);
            if (level != null) {
                addModules(modules, level.value(), module);
            } else {
                addModules(modules, 0, module);
            }
        }

        loadModules(modules);
    }
}
 
源代码16 项目: atomix   文件: AbstractAtomicMultimapService.java
@Override
public Collection<? extends byte[]> putAll(String key, Collection<? extends byte[]> values) {
  Set<byte[]> addedValues = Sets.newHashSet();
  for (byte[] value : values) {
    if (valueSet.add(value)) {
      addedValues.add(value);
    }
  }

  if (!addedValues.isEmpty()) {
    version = getCurrentIndex();
    return addedValues;
  }
  return null;
}
 
源代码17 项目: onos   文件: XconnectCodecTest.java
@Test
public void testEncodeLb() throws Exception {
    Set<XconnectEndpoint> endpoints1 = Sets.newHashSet(EP1, EP3);
    XconnectDesc desc1 = new XconnectDesc(KEY, endpoints1);

    ObjectMapper mapper = new ObjectMapper();
    InputStream jsonStream1 = XconnectCodecTest.class.getResourceAsStream("/xconnect2.json");
    JsonNode expected = mapper.readTree(jsonStream1);

    JsonNode actual = codec.encode(desc1, context);

    assertEquals(expected.get(XconnectCodec.DEVICE_ID), actual.get(XconnectCodec.DEVICE_ID));
    assertEquals(expected.get(XconnectCodec.VLAN_ID).asInt(), actual.get(XconnectCodec.VLAN_ID).asInt());
    assertEquals(expected.get(XconnectCodec.ENDPOINTS), actual.get(XconnectCodec.ENDPOINTS));
}
 
@Override
protected void runPass() {
  Map<String, GssFunction> functionMap = new DefaultGssFunctionMapProvider()
      .get();
  final boolean allowUnknownFunctions = false;
  final Set<String> allowedNonStandardFunctions = ImmutableSet.of();
  new ResolveCustomFunctionNodes(
      tree.getMutatingVisitController(), errorManager, functionMap,
      allowUnknownFunctions, allowedNonStandardFunctions).runPass();
}
 
源代码19 项目: ranger   文件: RangerSolrAuthorizer.java
private String getConjunctiveFilterQueryStr(Set<String> roles) {
	StringBuilder filterQuery = new StringBuilder();
	filterQuery
			.append(" {!").append(qParserName)
			.append(" set_field=\"").append(authField).append("\"")
			.append(" set_value=\"").append(Joiner.on(',').join(roles.iterator())).append("\"")
			.append(" count_field=\"").append(tokenCountField).append("\"");
	if (allRolesToken != null && !allRolesToken.equals("")) {
		filterQuery.append(" wildcard_token=\"").append(allRolesToken).append("\"");
	}
	filterQuery.append(" allow_missing_val=").append(allowMissingValue).append(" }");

	return filterQuery.toString();
}
 
源代码20 项目: Openfire   文件: PubSubModule.java
@Override
public void entityCapabilitiesChanged( @Nonnull final JID entity,
                                       @Nonnull final EntityCapabilities updatedEntityCapabilities,
                                       @Nonnull final Set<String> featuresAdded,
                                       @Nonnull final Set<String> featuresRemoved,
                                       @Nonnull final Set<String> identitiesAdded,
                                       @Nonnull final Set<String> identitiesRemoved )
{
    // Look for new +notify features. Those are the nodes that the entity is now interested in.
    final Set<String> nodeIDs = featuresAdded.stream()
        .filter(feature -> feature.endsWith("+notify"))
        .map(feature -> feature.substring(0, feature.length() - "+notify".length()))
        .collect(Collectors.toSet());

    if ( !nodeIDs.isEmpty() )
    {
        Log.debug( "Entity '{}' expressed new interest in receiving notifications for nodes '{}'", entity, String.join( ", ", nodeIDs ) );
        nodes.values().stream()
            .filter( Node::isSendItemSubscribe )
            .filter( node -> nodeIDs.contains( node.getUniqueIdentifier().getNodeId()) )
            .forEach( node -> {
                final NodeSubscription subscription = node.getSubscription(entity);
                if (subscription != null && subscription.isActive()) {
                    PublishedItem lastItem = node.getLastPublishedItem();
                    if (lastItem != null) {
                        subscription.sendLastPublishedItem(lastItem);
                    }
                }
            });
    }
}
 
源代码21 项目: pinpoint   文件: HbaseSchemaMapper.java
private Set<String> mapIncludeFiles(List<HbaseSchema.Include> schemaIncludes) {
    if (CollectionUtils.isEmpty(schemaIncludes)) {
        return Collections.emptySet();
    }
    Set<String> includeFiles = new LinkedHashSet<>();
    for (HbaseSchema.Include schemaInclude : schemaIncludes) {
        String includeFile = schemaInclude.getFile();
        if (includeFiles.contains(includeFile)) {
            throw new InvalidHbaseSchemaException("Duplicate include file : " + includeFile);
        }
        includeFiles.add(includeFile);
    }
    return includeFiles;
}
 
源代码22 项目: modeldb   文件: BlobDAORdbImpl.java
private Map<String, Set<BlobExpanded>> getCollectToMap(
    Map<String, Entry<BlobExpanded, String>> locationBlobsMapCommit) {
  return locationBlobsMapCommit.values().stream()
      .collect(
          Collectors.toMap(
              Entry::getValue,
              entry -> new LinkedHashSet<>(Collections.singletonList(entry.getKey())),
              (m1, m2) -> {
                LinkedHashSet<BlobExpanded> newHash = new LinkedHashSet<>(m1);
                newHash.addAll(m2);
                return newHash;
              },
              LinkedHashMap::new));
}
 
源代码23 项目: alibaba-rsocket-broker   文件: AppDetailPanel.java
public void setConsumedServices(Set<String> consumedServices) {
    if (consumedServices != null && !consumedServices.isEmpty()) {
        this.consumedServicesHeader.setVisible(true);
        this.consumedServices.setVisible(true);
        this.consumedServices.setText(String.join("\r\n", consumedServices));
    } else {
        this.consumedServicesHeader.setVisible(false);
        this.consumedServices.setVisible(false);
        this.consumedServices.setText("");
    }
}
 
源代码24 项目: datawave   文件: LuceneQueryParser.java
private void extractFilters(datawave.query.language.tree.QueryNode node, Set<FieldedTerm> filters) {
    if (node instanceof FunctionNode) {
        throw new IllegalArgumentException("Insufficient terms to evaluate");
    } else if (!(node instanceof SelectorNode)) {
        Set<FieldedTerm> alwaysFilterTerms = new HashSet<>();
        List<datawave.query.language.tree.QueryNode> childrenList = node.getChildren();
        extractAlwaysFilterNodes(alwaysFilterTerms, childrenList);
        filters.addAll(alwaysFilterTerms);
        node.setChildren(childrenList);
    }
    
    if (node instanceof SoftAndNode || node instanceof HardAndNode) {
        List<datawave.query.language.tree.QueryNode> evaluateNodes = new ArrayList<>();
        evaluateNodes.addAll(node.getChildren());
        Set<FieldedTerm> possibleFilters = extractFilters(evaluateNodes);
        
        if (!evaluateNodes.isEmpty()) {
            filters.addAll(possibleFilters);
            
            for (datawave.query.language.tree.QueryNode n : evaluateNodes) {
                extractFilters(n, filters);
            }
            node.setChildren(evaluateNodes);
        }
        
    } else if (node instanceof NotNode) {
        List<datawave.query.language.tree.QueryNode> children = node.getChildren();
        
        // If the first child of a NOT node might have filterable fields in it
        datawave.query.language.tree.QueryNode positiveNode = children.get(0);
        extractFilters(positiveNode, filters);
    }
}
 
源代码25 项目: openjdk-jdk8u   文件: PolicySourceModel.java
/**
 * Iterates through policy vocabulary and extracts set of namespaces used in
 * the policy expression.
 *
 * @return collection of used namespaces within given policy instance
 * @throws PolicyException Thrown if internal processing failed.
 */
private Collection<String> getUsedNamespaces() throws PolicyException {
    final Set<String> namespaces = new HashSet<String>();
    namespaces.add(getNamespaceVersion().toString());

    if (this.policyId != null) {
        namespaces.add(PolicyConstants.WSU_NAMESPACE_URI);
    }

    final Queue<ModelNode> nodesToBeProcessed = new LinkedList<ModelNode>();
    nodesToBeProcessed.add(rootNode);

    ModelNode processedNode;
    while ((processedNode = nodesToBeProcessed.poll()) != null) {
        for (ModelNode child : processedNode.getChildren()) {
            if (child.hasChildren()) {
                if (!nodesToBeProcessed.offer(child)) {
                    throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0081_UNABLE_TO_INSERT_CHILD(nodesToBeProcessed, child)));
                }
            }

            if (child.isDomainSpecific()) {
                final AssertionData nodeData = child.getNodeData();
                namespaces.add(nodeData.getName().getNamespaceURI());
                if (nodeData.isPrivateAttributeSet()) {
                    namespaces.add(PolicyConstants.SUN_POLICY_NAMESPACE_URI);
                }

                for (Entry<QName, String> attribute : nodeData.getAttributesSet()) {
                    namespaces.add(attribute.getKey().getNamespaceURI());
                }
            }
        }
    }

    return namespaces;
}
 
源代码26 项目: n4js   文件: Tracer.java
private void unsetOriginalASTNode_internal(EObject elementInIntermediateModel) {
	final EObject oldOriginalASTNode = im2ast.get(elementInIntermediateModel);
	if (oldOriginalASTNode != null) {
		final Set<EObject> lOld = ast2im.get(oldOriginalASTNode);
		if (lOld != null)
			lOld.remove(elementInIntermediateModel);
	}
}
 
源代码27 项目: datawave   文件: DiscoveryLogic.java
public static BatchScanner configureBatchScannerForDiscovery(DiscoveryQueryConfiguration config, ScannerFactory scannerFactory, String tableName,
                Collection<Range> seekRanges, Set<Text> columnFamilies, Multimap<String,String> literals, Multimap<String,String> patterns,
                Multimap<String,LiteralRange<String>> ranges, boolean reverseIndex) throws TableNotFoundException {
    
    // if we have no ranges, then nothing to scan
    if (seekRanges.isEmpty()) {
        return null;
    }
    
    BatchScanner bs = scannerFactory.newScanner(tableName, config.getAuthorizations(), config.getNumQueryThreads(), config.getQuery());
    bs.setRanges(seekRanges);
    if (!columnFamilies.isEmpty()) {
        for (Text family : columnFamilies) {
            bs.fetchColumnFamily(family);
        }
    }
    
    // The begin date from the query may be down to the second, for doing lookups in the index we want to use the day because
    // the times in the index table have been truncated to the day.
    Date begin = DateUtils.truncate(config.getBeginDate(), Calendar.DAY_OF_MONTH);
    // we don't need to bump up the end date any more because it's not apart of the range set on the scanner
    Date end = config.getEndDate();
    
    LongRange dateRange = new LongRange(begin.getTime(), end.getTime());
    
    ShardIndexQueryTableStaticMethods.configureGlobalIndexDateRangeFilter(config, bs, dateRange);
    ShardIndexQueryTableStaticMethods.configureGlobalIndexDataTypeFilter(config, bs, config.getDatatypeFilter());
    
    configureIndexMatchingIterator(config, bs, literals, patterns, ranges, reverseIndex);
    
    IteratorSetting discoveryIteratorSetting = new IteratorSetting(config.getBaseIteratorPriority() + 50, DiscoveryIterator.class);
    discoveryIteratorSetting.addOption(REVERSE_INDEX, Boolean.toString(reverseIndex));
    discoveryIteratorSetting.addOption(SEPARATE_COUNTS_BY_COLVIS, config.getSeparateCountsByColVis().toString());
    if (config.getShowReferenceCount()) {
        discoveryIteratorSetting.addOption(SHOW_REFERENCE_COUNT, config.getShowReferenceCount().toString());
    }
    bs.addScanIterator(discoveryIteratorSetting);
    
    return bs;
}
 
源代码28 项目: db   文件: BSqlMemoryManagerOld.java
/**
 * Gets all primary keys within the specified table in the form of an iterator. Only one key is loaded at any point
 * in this. No select governor limits apply on this function.
 *
 * @param app The application id of the application
 * @param table The table name of the table who's records are to be selected
 * @return An <code>Iterator<String></code> which iterates over primary keys of all records in the table.
 */
public Iterator<String> selectAllKeysAsStream(final String app, final String table) throws IOException {

    String tableName = app + "." + table;
    try {
        if (MemoryTableStore.exists(tableName)) {
            Set<String> allKeys = MemoryTableStore.getTable(tableName).getAllKeysAsString();
            return allKeys.iterator();
        }
    } catch (Exception e) {
        throw new IOException("selectAllKeysAsStream Error");
    }
    return null;
}
 
源代码29 项目: ontopia   文件: CollectionUtils.java
/**
 * INTERNAL: Compares two collections to see if they contain the same
 * elements.
 *
 * @since 1.4.1
 */
public static <T> boolean equalsUnorderedSet(Collection<T> coll1, Collection<T> coll2) {
  
  // Take care of nulls
  if (coll1 == null)
    if (coll2 == null)
      // 1: null 2: null
      return true;
    else
      // 1: null 2: not null
      return false;
  else
    if (coll2 == null)
      // 1: not null 2: null
      return false;
  
  // Compare set size
  int size1 = coll1.size();
  int size2 = coll2.size();    
  if (size1 != size2)
    return false;
  
  // If both have 1 element compare first element
  if (size1 == 1) {      
    return Objects.equals(coll1.iterator().next(), coll2.iterator().next());
  }
  
  // Compare collections as sets
  if (coll1 instanceof Set)
    if (coll2 instanceof Set)
      return coll1.equals(coll2);
    else
      return coll1.equals(new HashSet<T>(coll2));
  else if (coll2 instanceof Set)
    return coll2.equals(new HashSet<T>(coll1));
  else
    return new HashSet<T>(coll2).equals(new HashSet<T>(coll1));
}
 
源代码30 项目: molgenis   文件: PermissionServiceImpl.java
@Override
public Set<LabelledPermission> getPermissionsForObject(
    ObjectIdentity objectIdentity, Set<Sid> sids, boolean isReturnInheritedPermissions) {
  checkTypeExists(objectIdentity.getType());
  entityHelper.checkEntityExists(objectIdentity);
  Acl acl = mutableAclService.readAclById(objectIdentity);
  return getPermissionResponses(acl, isReturnInheritedPermissions, sids);
}
 
 类所在包
 同包方法