Set toArray - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Set toArray method.

This code example shows how to use the following methods:size, toArray
        Set<String> groups = userGroups.get(player.toLowerCase());
        if (groups == null) {
            return new String[0];
        } 
 
        return groups.toArray(new String[groups.size()]);
    } 
 
    public boolean hasPermission(OfflinePlayer player, String permission) {
        return hasPermission(player.getName(), permission);
    } 
 
    public boolean hasPermission(String worldName, OfflinePlayer player, String permission) {
        return hasPermission(worldName, player.getName(), permission);
    } 
 
    public boolean inGroup(OfflinePlayer player, String group) {
        return inGroup(player.getName(), group);
    } 
 
7
CodeRank
This code example shows how to use the following methods:size, toArray
		return IBeansModelElementTypes.IMPORT_TYPE; 
	} 
	 
	@Override 
	public IModelElement[] getElementChildren() { 
		Set<IModelElement> children = new LinkedHashSet<IModelElement>(
				getImportedBeansConfigs()); 
		return children.toArray(new IModelElement[children.size()]);
	} 
 
	@Override 
	public boolean equals(Object other) {
		if (this == other) {
			return true; 
		} 
		if (!(other instanceof BeansImport)) {
			return false; 
		} 
		BeansImport that = (BeansImport) other;
		if (!ObjectUtils.nullSafeEquals(this.resourcePath, that.resourcePath))
7
CodeRank
This code example shows how to use the following methods:size, toArray
	public URL[] getClasspath() {
		if (!StringUtils.hasLength(home)) {
			return new URL[0];
		} 
 
		Set<URL> urls = new LinkedHashSet<URL>();
 
		File rooHome = new File(home);
		if (rooHome.exists()) {
			addBootstrapJar(urls, rooHome, "bin");
			addBootstrapJar(urls, rooHome, "bundle");
		} 
		return urls.toArray(new URL[urls.size()]);
	} 
 
	public String getHome() {
		return home;
	} 
 
	public String getName() {
7
CodeRank
This code example shows how to use the following methods:removeAll, size, toArray
 
	/** 
	 * {@inheritDoc} 
	 */ 
	public RefactoringHistory removeAll(final RefactoringHistory history) {
		final Set existing= new LinkedHashSet(Arrays.asList(fDescriptorProxies));
		final Set other= new HashSet(Arrays.asList(history.getDescriptors()));
		existing.removeAll(other);
		final RefactoringDescriptorProxy[] proxies= new RefactoringDescriptorProxy[existing.size()];
		existing.toArray(proxies);
		return new RefactoringHistoryImplementation(proxies);
	} 
 
	/** 
	 * {@inheritDoc} 
	 */ 
	public String toString() {
		final StringBuffer buffer= new StringBuffer(256);
		buffer.append(getClass().getName());
		buffer.append("[descriptors="); //$NON-NLS-1$
7
CodeRank
This code example shows how to use the following methods:addAll, toArray
        final TransactionImporter transactionImporter = SubordinationManager.getTransactionImporter();
        return transactionImporter.importTransaction(xidTransactionID.getXid(), txTimeout);
    } 
 
    public Xid[] getXidsToRecoverForParentNode(final String parentNodeName, int recoveryFlags) throws XAException {
        final Set<Xid> xidsToRecover = new HashSet<Xid>();
        final TransactionImporter transactionImporter = SubordinationManager.getTransactionImporter();
        if (transactionImporter instanceof TransactionImporterImple) {
            final Set<Xid> inFlightXids = ((TransactionImporterImple) transactionImporter).getInflightXids(parentNodeName);
            if (inFlightXids != null) {
                xidsToRecover.addAll(inFlightXids);
            } 
        } 
        final XATerminator xaTerminator = SubordinationManager.getXATerminator();
        if (xaTerminator instanceof XATerminatorImple) {
            final Xid[] inDoubtTransactions = ((XATerminatorImple) xaTerminator).doRecover(null, parentNodeName);
            if (inDoubtTransactions != null) {
                xidsToRecover.addAll(Arrays.asList(inDoubtTransactions));
            } 
        } else { 

8
CodeRank
This code example shows how to use the following methods:size, toArray
 
    @Override 
    public void mutate() { 
        // We only ever have to perform a replace once within a batch 
        if (this.mutated.compareAndSet(false, true)) {
            this.invoker.invoke(this.cache, new MutateOperation<>(this.id, this.value), this.flags.toArray(new Flag[this.flags.size()]));
        } 
    } 
 
    public static boolean isMutable(Object object) {
        for (Object value: IMMUTABLE_VALUES) {
            if (object == value) return false;
        } 
        for (Class<?> immutableClass: IMMUTABLE_TYPES) {
            if (immutableClass.isInstance(object)) return false;
        } 
        return !object.getClass().isAnnotationPresent(Immutable.class);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:toArray
This code example shows how to use the following methods:size, toArray
  public ApplicationId getApplicationID() { 
    return applicationId;
  } 
 
  public String[] getHosts() {
    return hosts.toArray(new String[hosts.size()]);
  } 
   
  public String[] getRacks() {
    return racks.toArray(new String[racks.size()]);
  } 
   
  public boolean canSchedule(NodeType type, String hostName) {
    if (type == NodeType.NODE_LOCAL) { 
      return hosts.contains(hostName);
    } else if (type == NodeType.RACK_LOCAL) {
      return racks.contains(Application.resolve(hostName));
    }  
     
    return true; 
8
CodeRank
This code example shows how to use the following methods:add, contains, size, toArray
 
 
    private static <T> T don(IThing thing, Class<T> intface) {
        TraitMantle mantle = (TraitMantle) thing.getMantle();
 
        if (mantle.types.contains(intface)) {
            rebindImpl(mantle, intface);
            return (T) mantle.proxy;
        } 
 
 
        Class[] interfaces = (Class[]) mantle.types.toArray(new Class[mantle.types.size()]);
        interfaces = Arrays.copyOf(interfaces,interfaces.length + 1);
        interfaces[interfaces.length-1] = intface;
 
        T proxy = (T) Proxy.newProxyInstance(TraitMantle.class.getClassLoader(),
                interfaces,
                mantle );
 
        mantle.types.add(intface);

6
CodeRank
This code example shows how to use the following methods:size, toArray
		this.constructorArg = constructorArg;
	} 
 
	public IPropertyDescriptor[] getPropertyDescriptors() { 
		return descriptors
				.toArray(new IPropertyDescriptor[descriptors.size()]);
	} 
 
	public Object getPropertyValue(Object id) {
		if (P_ID_BEAN.equals(id)) {
			IBean bean = (IBean) constructorArg.getElementParent();
			if (bean.isRootBean()) {
				return new RootBeanProperties(bean);
			} else if (bean.isChildBean()) {
				return new ChildBeanProperties(bean);
			} else { 
				// FIXME add factory bean support 
				// return new FactoryBeanProperties(bean); 
			} 
		} else if (P_ID_INDEX.equals(id)) {
6
CodeRank

Related Set toArray Questions & Answers:

toArray Method Overview
Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array.
See Code Examples for other Java 8 Set Methods: