Example usage for java.util Collections unmodifiableCollection

List of usage examples for java.util Collections unmodifiableCollection

Introduction

In this page you can find the example usage for java.util Collections unmodifiableCollection.

Prototype

public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c) 

Source Link

Document

Returns an unmodifiable view of the specified collection.

Usage

From source file:nz.co.senanque.vaadinsupport.application.MaduraSessionManager.java

private Collection<Label> getLabels() {
    return Collections.unmodifiableCollection(m_labels.values());
}

From source file:com.netflix.config.ConcurrentMapConfiguration.java

@Override
public Collection<ConfigurationErrorListener> getErrorListeners() {
    return Collections.unmodifiableCollection(errorListeners);
}

From source file:com.eviware.soapui.plugins.PluginManager.java

public Collection<Plugin> getInstalledPlugins() {
    Set<Plugin> plugins = new HashSet<Plugin>();
    for (InstalledPluginRecord installedPluginRecord : installedPlugins.values()) {
        plugins.add(installedPluginRecord.plugin);
    }//from   w  w  w .j a v  a 2  s.  c o  m
    return Collections.unmodifiableCollection(plugins);
}

From source file:de.btobastian.javacord.entities.impl.ImplServer.java

@Override
public Collection<Role> getRoles() {
    return Collections.unmodifiableCollection(roles.values());
}

From source file:ch.uzh.fabric.config.TestConfig.java

public Collection<SampleOrg> getIntegrationTestsSampleOrgs() {
    return Collections.unmodifiableCollection(sampleOrgs.values());
}

From source file:com.ikanow.aleph2.core.shared.services.MultiDataService.java

/** Returns a list of batch data writers
 * @return//from ww  w.j av a 2s . co  m
 */
public Collection<IDataWriteService.IBatchSubservice<JsonNode>> getBatchWriters() {
    return Collections.unmodifiableCollection(_batches.keySet());
}

From source file:de.ailis.threedee.assets.Assets.java

/**
 * Returns all loaded textures.// w  w  w  .ja v  a 2  s.c  o m
 *
 * @return The loaded textures. Never null. May be empty.
 */

public Collection<Scene> getScenes() {
    return Collections.unmodifiableCollection(this.scenes.values());
}

From source file:com.ikanow.aleph2.core.shared.services.MultiDataService.java

/** Returns a list of CRUD data writers that don't have a batch writer
 * @return//from w  w  w  .j a  v  a 2s .  c  o m
 */
public Collection<IDataWriteService<JsonNode>> getCrudOnlyWriters() {
    return Collections.unmodifiableCollection(_crud_onlys.keySet());
}

From source file:com.datatorrent.lib.io.fs.AbstractBlockReader.java

/**
 * <b>Note:</b> This partitioner does not support parallel partitioning.<br/><br/>
 * {@inheritDoc}//from w  w  w .ja  v  a  2s.c o  m
 */
@SuppressWarnings("unchecked")
@Override
public Collection<Partition<AbstractBlockReader<R>>> definePartitions(
        Collection<Partition<AbstractBlockReader<R>>> partitions, PartitioningContext context) {
    if (partitions.iterator().next().getStats() == null) {
        //First time when define partitions is called
        return partitions;
    }
    //Collect state here
    List<FileSplitter.BlockMetadata> pendingBlocks = Lists.newArrayList();
    for (Partition<AbstractBlockReader<R>> partition : partitions) {
        pendingBlocks.addAll(partition.getPartitionedInstance().blockQueue);
    }

    int morePartitionsToCreate = partitionCount - partitions.size();

    if (morePartitionsToCreate < 0) {
        //Delete partitions
        Iterator<Partition<AbstractBlockReader<R>>> partitionIterator = partitions.iterator();
        while (morePartitionsToCreate++ < 0) {
            Partition<AbstractBlockReader<R>> toRemove = partitionIterator.next();
            LOG.debug("partition removed {}", toRemove.getPartitionedInstance().operatorId);
            partitionIterator.remove();
        }
    } else {
        //Add more partitions
        while (morePartitionsToCreate-- > 0) {
            AbstractBlockReader<R> blockReader;
            try {
                blockReader = this.getClass().newInstance();
            } catch (InstantiationException e) {
                throw new RuntimeException(e);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
            DefaultPartition<AbstractBlockReader<R>> partition = new DefaultPartition<AbstractBlockReader<R>>(
                    blockReader);
            partitions.add(partition);
        }
    }

    DefaultPartition.assignPartitionKeys(Collections.unmodifiableCollection(partitions), blocksMetadataInput);
    int lPartitionMask = partitions.iterator().next().getPartitionKeys().get(blocksMetadataInput).mask;

    //transfer the state here
    for (Partition<AbstractBlockReader<R>> newPartition : partitions) {
        AbstractBlockReader<R> reader = newPartition.getPartitionedInstance();

        reader.partitionKeys = newPartition.getPartitionKeys().get(blocksMetadataInput).partitions;
        reader.partitionMask = lPartitionMask;
        LOG.debug("partitions {},{}", reader.partitionKeys, reader.partitionMask);
        reader.blockQueue.clear();

        //distribute block-metadatas
        Iterator<FileSplitter.BlockMetadata> pendingBlocksIterator = pendingBlocks.iterator();
        while (pendingBlocksIterator.hasNext()) {
            FileSplitter.BlockMetadata pending = pendingBlocksIterator.next();
            if (reader.partitionKeys.contains(pending.hashCode() & lPartitionMask)) {
                reader.blockQueue.add(pending);
                pendingBlocksIterator.remove();
            }
        }
    }
    return partitions;
}

From source file:com.diversityarrays.kdxplore.data.kdx.CurationData.java

public Collection<Trait> getTraits() {
    return Collections.unmodifiableCollection(traitByTraitId.values());
}