Example usage for java.util Collections unmodifiableSortedSet

List of usage examples for java.util Collections unmodifiableSortedSet

Introduction

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

Prototype

public static <T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> s) 

Source Link

Document

Returns an unmodifiable view of the specified sorted set.

Usage

From source file:Main.java

public static void main(String[] s) {
    SortedSet<String> set = new TreeSet<String>();

    set.add("Welcome");
    set.add("to");
    set.add("java2s.com");

    System.out.println("Initial set value: " + set);

    // create unmodifiable sorted set
    Set<String> unmodsortset = Collections.unmodifiableSortedSet(set);

    // try to modify the sorted set
    unmodsortset.add("Hello");
}

From source file:Main.java

/**
 * Get the sorted selected positions in a byte with the right most
 * position as zero./*  w  ww.j a  v a 2  s .co m*/
 * @param input Byte to be evaluated
 * @return Array of integer positions.
 */
public static SortedSet<Integer> getSelectedPCR(byte input) {
    ArrayList<Integer> arrayList = new ArrayList<Integer>();
    byte mask = 0x01;
    for (int i = 0; i <= 7; i++) {
        int value = (input >>> i) & mask;
        if (value == 1) {
            arrayList.add(i);
        }
    }
    Collections.sort(arrayList);
    return Collections.unmodifiableSortedSet(new TreeSet<Integer>(arrayList));
}

From source file:com.gammalabs.wifianalyzer.wifi.band.WiFiChannelCountryGHZ2.java

SortedSet<Integer> findChannels(@NonNull String countryCode) {
    SortedSet<Integer> result = world;
    String code = StringUtils.capitalize(countryCode);
    if (countries.contains(code)) {
        result = channels;/*w w  w.  j a  v  a 2 s .co m*/
    }
    return Collections.unmodifiableSortedSet(result);
}

From source file:au.id.hazelwood.xmltvguidebuilder.model.ChannelListings.java

public SortedSet<ProgrammeDetail> getPrograms(Integer channelId) {
    return Collections.unmodifiableSortedSet(programsByChannelId.get(channelId));
}

From source file:gov.nih.nci.caintegrator.domain.genomic.Platform.java

/**
 * @return the reporterLists
 */
public SortedSet<ReporterList> getReporterLists() {
    return Collections.unmodifiableSortedSet(getReporterListsInternal());
}

From source file:net.dv8tion.jda.core.utils.cache.impl.SortedSnowflakeCacheView.java

@Override
public SortedSet<T> asSet() {
    SortedSet<T> set = new TreeSet<>(comparator);
    elements.forEachValue(set::add);/*from  w w  w  .ja  v  a2 s  .c o m*/
    return Collections.unmodifiableSortedSet(set);
}

From source file:org.netkernelroc.gradle.apposite.Package.java

public SortedSet<PackageVersion> getVersions() {
    return Collections.unmodifiableSortedSet(versions);
}

From source file:io.promagent.internal.HookMetadataParser.java

public HookMetadataParser(Collection<Path> hookJars) {
    this.hookJars = Collections.unmodifiableSortedSet(new TreeSet<>(hookJars));
}

From source file:gov.nih.nci.caintegrator.domain.genomic.Platform.java

/**
 * Returns all <code>ReporterLists</code> of the requested type.
 *
 * @param reporterType get lists of this type.
 * @return the reporterLists//  w w  w  . ja  va 2 s .com
 */
public SortedSet<ReporterList> getReporterLists(ReporterTypeEnum reporterType) {
    return Collections.unmodifiableSortedSet(getTypeToReporterListMap().get(reporterType));
}

From source file:org.cbioportal.mutationhotspots.mutationhotspotsdetection.impl.HotspotImpl.java

/**
 * 
 * @return residues
 */
@Override
public SortedSet<Integer> getResidues() {
    return Collections.unmodifiableSortedSet(residues);
}