Example usage for java.util TreeSet TreeSet

List of usage examples for java.util TreeSet TreeSet

Introduction

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

Prototype

public TreeSet(SortedSet<E> s) 

Source Link

Document

Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.

Usage

From source file:com.mycsense.carbondb.domain.Dimension.java

public Dimension(Dimension dimension) {
    this();
    keywords = new TreeSet<>(dimension.keywords);
}

From source file:fr.cvlaminck.merging.impl.DefaultValueMergers.java

public DefaultValueMergers() {
    this.registeredMergerTypes = new TreeSet<Class<?>>(new Comparator<Class<?>>() {
        @Override// w  w w .  j  a v  a  2  s.c o  m
        public int compare(Class<?> c1, Class<?> c2) {
            if (c2.isAssignableFrom(c1))
                return -1;
            return 1;
        }
    });
    this.mergers = new HashMap<>();
}

From source file:com.github.pjungermann.config.errors.KeysWithoutSpecificationErrorTest.java

@Test
public void getMessage_always_returnCorrectMessage() {
    List<String> keys = Arrays.asList("key1", "key2", "key3");
    KeysWithoutSpecificationError error = new KeysWithoutSpecificationError(keys);

    MessageSourceResolvable resolvable = error.getMessage();

    assertNotNull(resolvable);//from  w  ww . ja  v a 2  s.c o m
    assertArrayEquals(new String[] { error.getMessageCode() }, resolvable.getCodes());
    assertArrayEquals(new Object[] { new TreeSet<>(keys) }, resolvable.getArguments());
    assertEquals(error.getMessageCode(), resolvable.getDefaultMessage());
}

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.ListShiftsToImportLessonPlanningsProvider.java

@Override
public Object provide(Object source, Object currentValue) {

    ImportLessonPlanningsBean bean = (ImportLessonPlanningsBean) source;
    Set<Shift> shifts = new TreeSet<Shift>(Shift.SHIFT_COMPARATOR_BY_TYPE_AND_ORDERED_LESSONS);

    ExecutionCourse executionCourseFrom = bean.getExecutionCourse();
    ExecutionCourse executionCourseTo = bean.getExecutionCourseTo();

    if (executionCourseFrom != null && executionCourseTo != null) {

        List<ShiftType> shiftTypesTo = new ArrayList<ShiftType>();
        for (ShiftType shiftType : executionCourseTo.getShiftTypes()) {
            if (executionCourseTo.hasCourseLoadForType(shiftType)) {
                shiftTypesTo.add(shiftType);
            }//  ww  w .j  a  va 2s. c  o m
        }

        for (Shift shift : executionCourseFrom.getAssociatedShifts()) {
            if (CollectionUtils.containsAny(shiftTypesTo, shift.getTypes())) {
                shifts.add(shift);
            }
        }

        if (shifts.isEmpty()) {
            return executionCourseFrom.getAssociatedShifts();
        }
    }

    return shifts;
}

From source file:raging.goblin.miwakeuplightswarm.domain.WakeUpSchedule.java

public Set<DayOfWeek> getDaysActive() {
    return new TreeSet<>(daysActive);
}

From source file:com.vrem.wifianalyzer.wifi.channelgraph.DataManager.java

Set<WiFiDetail> getNewSeries(@NonNull List<WiFiDetail> wiFiDetails,
        @NonNull Pair<WiFiChannel, WiFiChannel> wiFiChannelPair) {
    return new TreeSet<>(CollectionUtils.select(wiFiDetails, new InRangePredicate(wiFiChannelPair)));
}

From source file:com.music.service.PiecePackService.java

@Transactional(readOnly = true)
public List<PiecePack> getPiecePacks() {
    List<PiecePack> packs = dao.listOrdered(PiecePack.class, "priority");
    // order pieces in memory, by likes
    for (PiecePack pack : packs) {
        TreeSet<Piece> pieces = new TreeSet<>(pieceComparator);
        pieces.addAll(pack.getPieces());
        pack.setPieces(pieces);/*from   ww w  .  j a  v  a  2  s  .c o  m*/
    }
    return packs;
}

From source file:com.intuit.karate.http.jersey.LoggingInterceptor.java

private static void logHeaders(StringBuilder sb, int id, char prefix, MultivaluedMap<String, String> headers) {
    Set<String> keys = new TreeSet(headers.keySet());
    for (String key : keys) {
        List<String> entries = headers.get(key);
        sb.append(id).append(' ').append(prefix).append(' ').append(key).append(": ")
                .append(entries.size() == 1 ? entries.get(0) : entries).append('\n');
    }/*www.  ja  va 2  s .  c  o  m*/
}

From source file:edu.cornell.mannlib.vitro.webapp.modelaccess.ontmodels.JoinedOntModelCache.java

@Override
public SortedSet<String> getModelNames() {
    SortedSet<String> allNames = new TreeSet<>(primary.getModelNames());
    allNames.addAll(secondary.getModelNames());
    return allNames;
}

From source file:alluxio.shell.command.HelpCommand.java

@Override
public int run(CommandLine cl) throws AlluxioException, IOException {
    String[] args = cl.getArgs();
    SortedSet<String> sortedCmds = null;
    AlluxioShellUtils.loadCommands(mFileSystem, mCommands);
    if (args.length == 0) {
        // print help messages for all supported commands.
        sortedCmds = new TreeSet<>(mCommands.keySet());
        for (String cmd : sortedCmds) {
            printCommandInfo(cmd);//from   ww  w.  j av  a 2s . c  om
        }
    } else if (mCommands.containsKey(args[0])) {
        printCommandInfo(args[0]);
    } else {
        System.out.println(args[0] + " is an unknown command.");
    }
    return 0;
}