Example usage for java.util Collections unmodifiableList

List of usage examples for java.util Collections unmodifiableList

Introduction

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

Prototype

public static <T> List<T> unmodifiableList(List<? extends T> list) 

Source Link

Document

Returns an unmodifiable view of the specified list.

Usage

From source file:com.amazonaws.services.kinesis.stormspout.ShardInfo.java

/**
 * @return immutable view of the shards resulting from the split. Empty list if the shard does
 * not split./*from w  ww.j a  va  2  s .c o  m*/
 */
List<String> getSplitsInto() {
    return Collections.unmodifiableList(splitsInto);
}

From source file:org.cloudfoundry.tools.io.ResourceURL.java

/**
 * Get a {@link List} of {@link URL}s for the given {@link Resource}s.
 * //from  ww  w  . j a  v a  2 s .co  m
 * @param resources
 * @param nonLocking if the URL should protect against file locking
 * @return a list of URLs for the resource
 * @throws MalformedURLException
 */
public static List<URL> getForResources(Iterable<? extends Resource> resources, boolean nonLocking)
        throws MalformedURLException {
    List<URL> urls = new ArrayList<URL>();
    for (Resource resource : resources) {
        urls.add(get(resource, nonLocking));
    }
    return Collections.unmodifiableList(urls);
}

From source file:cz.fi.muni.pa165.facade.GameFacadeImpl.java

@Override
public List<GameDTO> findAll() {
    List<GameDTO> games = new ArrayList<>();
    gameService.findAll().stream().forEach((g) -> {
        games.add(beanMappingService.mapTo(calculateScore(g), GameDTO.class));
    });//from w w w.  j av a  2s .com
    return Collections.unmodifiableList(games);
}

From source file:ru.jts_dev.gameserver.parser.impl.SettingsHolder.java

public final List<CharacterStat> getMinimumStats() {
    return Collections.unmodifiableList(minimumStats);
}

From source file:eu.stratosphere.api.common.operators.util.FieldList.java

@Override
public FieldList addFields(int... fieldIDs) {
    if (fieldIDs == null || fieldIDs.length == 0) {
        return this;
    }//from  w w w .  ja  va2s .c o  m
    if (size() == 0) {
        return new FieldList(fieldIDs);
    } else {
        ArrayList<Integer> list = new ArrayList<Integer>(size() + fieldIDs.length);
        list.addAll(this.collection);
        for (int i = 0; i < fieldIDs.length; i++) {
            list.add(fieldIDs[i]);
        }

        return new FieldList(Collections.unmodifiableList(list));
    }
}

From source file:com.optimizely.ab.config.ProjectConfig.java

@JsonCreator
public ProjectConfig(@JsonProperty("accountId") String accountId, @JsonProperty("projectId") String projectId,
        @JsonProperty("version") String version, @JsonProperty("revision") String revision,
        @JsonProperty("groups") List<Group> groups, @JsonProperty("experiments") List<Experiment> experiments,
        @JsonProperty("dimensions") List<Attribute> attributes,
        @JsonProperty("events") List<EventType> eventType,
        @JsonProperty("audiences") List<Audience> audiences) {

    this.accountId = accountId;
    this.projectId = projectId;
    this.version = version;
    this.revision = revision;

    this.groups = Collections.unmodifiableList(groups);
    List<Experiment> allExperiments = new ArrayList<Experiment>();
    allExperiments.addAll(experiments);/*  w  w w  . j a v a 2  s . c  o  m*/
    allExperiments.addAll(aggregateGroupExperiments(groups));
    this.experiments = Collections.unmodifiableList(allExperiments);
    this.attributes = Collections.unmodifiableList(attributes);
    this.events = Collections.unmodifiableList(eventType);
    this.audiences = Collections.unmodifiableList(audiences);

    // generate the name mappers
    this.experimentKeyMapping = ProjectConfigUtils.generateNameMapping(this.experiments);
    this.attributeKeyMapping = ProjectConfigUtils.generateNameMapping(attributes);
    this.eventNameMapping = ProjectConfigUtils.generateNameMapping(events);

    // generate audience id to audience mapping
    this.audienceIdMapping = ProjectConfigUtils.generateIdMapping(audiences);
    this.experimentIdMapping = ProjectConfigUtils.generateIdMapping(this.experiments);
    this.groupIdMapping = ProjectConfigUtils.generateIdMapping(groups);
}

From source file:de.xirp.profile.ProfileManager.java

/**
 * Returns all completed//from   w w  w.  ja  v a  2s.  c om
 * {@link de.xirp.profile.Profile profiles}.
 * 
 * @return An unmodifiable list with the completed profiles.
 * @see de.xirp.profile.Profile
 */
public static List<Profile> getProfiles() {
    return Collections.unmodifiableList(profiles.values());
}

From source file:ar.com.zauber.commons.moderation.model.MockModerationEntryRepository.java

/** @see ModerationEntryRepository#getModerationEntries(Moderateable) */
public final List<ModerationEntry> getModerationEntries(final Moderateable m) {
    if (map.containsKey(m)) {
        return Collections.unmodifiableList(map.get(m));
    }// w  ww.  ja  v a 2s. c om
    return Collections.unmodifiableList(new ArrayList<ModerationEntry>());
}

From source file:it.anyplace.sync.core.beans.FileInfo.java

private FileInfo(String folder, FileType type, String path, @Nullable Long size, @Nullable Date lastModified,
        @Nullable String hash, @Nullable List<Version> versionList, boolean deleted) {
    checkNotNull(Strings.emptyToNull(folder));
    checkNotNull(path);//allow empty for 'fake' root path
    checkNotNull(type);/*from ww w  .ja  v a2s .co  m*/
    this.folder = folder;
    this.type = type;
    this.path = path;
    if (PathUtils.isParent(path)) {
        this.fileName = PARENT_PATH;
        this.parent = ROOT_PATH;
    } else {
        this.fileName = PathUtils.getFileName(path);
        this.parent = PathUtils.isRoot(path) ? ROOT_PATH : PathUtils.getParentPath(path);
    }
    this.lastModified = MoreObjects.firstNonNull(lastModified, new Date(0));
    if (type.equals(FileType.DIRECTORY)) {
        this.size = null;
        this.hash = null;
    } else {
        checkNotNull(size);
        checkNotNull(emptyToNull(hash));
        this.size = size;
        this.hash = hash;
    }
    this.versionList = Collections
            .unmodifiableList(MoreObjects.firstNonNull(versionList, Collections.<Version>emptyList()));
    this.deleted = deleted;
}

From source file:com.branded.holdings.qpc.model.Pet.java

public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}