Example usage for org.apache.commons.collections4.list UnmodifiableList UnmodifiableList

List of usage examples for org.apache.commons.collections4.list UnmodifiableList UnmodifiableList

Introduction

In this page you can find the example usage for org.apache.commons.collections4.list UnmodifiableList UnmodifiableList.

Prototype

@SuppressWarnings("unchecked") 
public UnmodifiableList(final List<? extends E> list) 

Source Link

Document

Constructor that wraps (not copies).

Usage

From source file:com.offbynull.voip.audio.gateways.io.internalmessages.LoadDevicesResponse.java

/**
 * Constructs a {@link LoadDevicesResponse} object.
 * @param outputDevices list of output devices
 * @param inputDevices list of input devices
 * @throws NullPointerException if any argument is {@code null} or contains {@code null}
 *//*from  www. j a va2  s  .  co  m*/
public LoadDevicesResponse(List<OutputDevice> outputDevices, List<InputDevice> inputDevices) {
    Validate.notNull(outputDevices);
    Validate.notNull(inputDevices);
    Validate.noNullElements(outputDevices);
    Validate.noNullElements(inputDevices);

    this.outputDevices = (UnmodifiableList<OutputDevice>) UnmodifiableList
            .unmodifiableList(new ArrayList<>(outputDevices));
    this.inputDevices = (UnmodifiableList<InputDevice>) UnmodifiableList
            .unmodifiableList(new ArrayList<>(inputDevices));
}

From source file:com.offbynull.peernetic.playground.chorddht.messages.external.GetSuccessorResponse.java

public GetSuccessorResponse(List<Pointer> pointers) {
    Validate.noNullElements(pointers);/*  ww w  .jav  a2s .co  m*/

    List<SuccessorEntry<A>> entries = new ArrayList<>(pointers.size());
    pointers.stream().map(x -> {
        if (x instanceof InternalPointer) {
            return new InternalSuccessorEntry<A>(x.getId().getValueAsByteArray());
        } else if (x instanceof ExternalPointer) {
            return new ExternalSuccessorEntry<A>(x.getId().getValueAsByteArray(),
                    ((ExternalPointer<A>) x).getAddress());
        } else {
            throw new IllegalArgumentException();
        }
    }).forEachOrdered(x -> entries.add(x));

    this.entries = new UnmodifiableList<>(entries);
    validate();
}

From source file:com.offbynull.coroutines.instrumenter.MethodAttributes.java

MethodAttributes(MethodSignature signature, InstrumentationSettings settings,
        List<ContinuationPoint> continuationPoints, List<SynchronizationPoint> synchPoints,
        CoreVariables coreVars, CacheVariables cacheVars, StorageContainerVariables storageContainerVars,
        StorageVariables localsStorageVars, StorageVariables stackStorageVars, LockVariables lockVars) {
    Validate.notNull(signature);//from   w ww. j  a va  2 s .co  m
    Validate.notNull(settings);
    Validate.notNull(continuationPoints);
    Validate.notNull(synchPoints);
    Validate.notNull(coreVars);
    Validate.notNull(cacheVars);
    Validate.notNull(storageContainerVars);
    Validate.notNull(localsStorageVars);
    Validate.notNull(stackStorageVars);
    Validate.notNull(lockVars);
    Validate.noNullElements(continuationPoints);
    Validate.noNullElements(synchPoints);

    this.signature = signature;
    this.settings = settings;
    this.continuationPoints = (UnmodifiableList<ContinuationPoint>) UnmodifiableList
            .unmodifiableList(new ArrayList<>(continuationPoints));
    this.synchPoints = (UnmodifiableList<SynchronizationPoint>) UnmodifiableList
            .unmodifiableList(new ArrayList<>(synchPoints));
    this.coreVars = coreVars;
    this.cacheVars = cacheVars;
    this.storageContainerVars = storageContainerVars;
    this.localsStorageVars = localsStorageVars;
    this.stackStorageVars = stackStorageVars;
    this.lockVars = lockVars;
}

From source file:com.offbynull.voip.kademlia.model.NodeChangeSet.java

NodeChangeSet(Collection<Node> added, Collection<Node> removed, Collection<Node> updated) {
    Validate.notNull(removed);//from   ww  w.  j a  v  a  2s. c  o m
    Validate.notNull(added);
    Validate.notNull(updated);
    Validate.noNullElements(removed);
    Validate.noNullElements(added);
    Validate.noNullElements(updated);

    // ensure that there aren't any duplicate ids
    Set<Id> tempSet = new HashSet<>();
    removed.stream().map(x -> x.getId()).forEach(x -> tempSet.add(x));
    added.stream().map(x -> x.getId()).forEach(x -> tempSet.add(x));
    updated.stream().map(x -> x.getId()).forEach(x -> tempSet.add(x));
    Validate.isTrue(tempSet.size() == added.size() + removed.size() + updated.size());

    this.removed = (UnmodifiableList<Node>) UnmodifiableList.unmodifiableList(new ArrayList<>(removed));
    this.added = (UnmodifiableList<Node>) UnmodifiableList.unmodifiableList(new ArrayList<>(added));
    this.updated = (UnmodifiableList<Node>) UnmodifiableList.unmodifiableList(new ArrayList<>(updated));
}

From source file:com.offbynull.voip.kademlia.model.ActivityChangeSet.java

ActivityChangeSet(Collection<Activity> added, Collection<Activity> removed, Collection<Activity> updated) {
    Validate.notNull(removed);//  w w  w.  j  av  a2s. co  m
    Validate.notNull(added);
    Validate.notNull(updated);
    Validate.noNullElements(removed);
    Validate.noNullElements(added);
    Validate.noNullElements(updated);

    // ensure that there aren't any duplicate ids
    Set<Id> tempSet = new HashSet<>();
    removed.stream().map(x -> x.getNode().getId()).forEach(x -> tempSet.add(x));
    added.stream().map(x -> x.getNode().getId()).forEach(x -> tempSet.add(x));
    updated.stream().map(x -> x.getNode().getId()).forEach(x -> tempSet.add(x));
    Validate.isTrue(tempSet.size() == added.size() + removed.size() + updated.size());

    this.removed = (UnmodifiableList<Activity>) UnmodifiableList.unmodifiableList(new ArrayList<>(removed));
    this.added = (UnmodifiableList<Activity>) UnmodifiableList.unmodifiableList(new ArrayList<>(added));
    this.updated = (UnmodifiableList<Activity>) UnmodifiableList.unmodifiableList(new ArrayList<>(updated));
}

From source file:org.linqs.psl.reasoner.admm.term.ADMMObjectiveTerm.java

public List<LocalVariable> getVariables() {
    return new UnmodifiableList<LocalVariable>(variables);
}

From source file:org.linqs.psl.reasoner.term.MemoryTermStore.java

@Override
public List<Integer> getTermIndices(WeightedGroundRule rule) {
    return new UnmodifiableList<Integer>(ruleMapping.get(rule));
}