Example usage for com.google.common.collect Sets newLinkedHashSet

List of usage examples for com.google.common.collect Sets newLinkedHashSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets newLinkedHashSet.

Prototype

public static <E> LinkedHashSet<E> newLinkedHashSet(Iterable<? extends E> elements) 

Source Link

Document

Creates a mutable LinkedHashSet instance containing the given elements in order.

Usage

From source file:net.sourceforge.ganttproject.CalendarEventAction.java

public static CalendarEventAction addException(GPCalendar calendar, Date date,
        final GPUndoManager undoManager) {
    return new CalendarEventAction(calendar, date, "calendar.action.weekendException.add") {
        @Override/*from  w  w  w.  j  a va  2s  .  c om*/
        public void actionPerformed(ActionEvent e) {
            final Set<CalendarEvent> events = Sets.newLinkedHashSet(myCalendar.getPublicHolidays());
            events.add(CalendarEvent.newEvent(myDate, false, Type.WORKING_DAY,
                    GanttLanguage.getInstance().getText("calendar.action.weekendException.add.description"),
                    null));
            undoManager.undoableEdit(getLocalizedName(), new Runnable() {
                @Override
                public void run() {
                    myCalendar.setPublicHolidays(events);
                }
            });
        }
    };
}

From source file:com.cloudera.science.ml.core.vectors.Centers.java

/**
 * Create a new instance from the given points. Any duplicate
 * points in the {@code Iterable} instance will be removed.
 * /*  w w  w. j  a va  2s . co  m*/
 * @param points The points
 * @throws IllegalArgumentException if the input is empty
 */
public Centers(Iterable<Vector> points) {
    this.centers = ImmutableList.copyOf(Sets.newLinkedHashSet(points));
}

From source file:com.sk89q.worldguard.session.handler.FarewellFlag.java

private Set<String> getMessages(LocalPlayer player, ApplicableRegionSet set) {
    return Sets.newLinkedHashSet(set.queryAllValues(player, Flags.FAREWELL_MESSAGE));
}

From source file:clientapi.manage.Node.java

/**
 * @return The set of all child nodes/* w  w  w .ja  v a2  s .  co m*/
 */
public final Collection<Node> getChildren() {
    return Sets.newLinkedHashSet(this.children);
}

From source file:org.sakaiproject.nakamura.api.lite.authorizable.Group.java

public Group(Map<String, Object> groupMap) {
    super(groupMap);
    this.members = Sets.newLinkedHashSet(
            Iterables.of(StringUtils.split((String) authorizableMap.get(MEMBERS_FIELD), ';')));
    this.membersAdded = Sets.newHashSet();
    this.membersRemoved = Sets.newHashSet();
    membersModified = true;//from w w  w  .jav a  2  s .c o m
}

From source file:ch.puzzle.itc.mobiliar.business.generator.control.extracted.templates.GenerationPackage.java

/**
 * @returns a flattened Set of GenerationUnits of the Tree starting on the leaves
 *///from w ww  .j  av  a  2 s .co m
public Set<GenerationUnit> getAsSet() {
    List<GenerationUnit> all = new ArrayList<GenerationUnit>();
    for (GenerationSubPackage subPackage : generationSubPackages) {
        all.addAll(subPackage.getSubGenerationUnitsAsList());
    }
    return Sets.newLinkedHashSet(removeDuplicates(all));
}

From source file:com.google.inject.internal.ProvisionListenerStackCallback.java

public ProvisionListenerStackCallback(Binding<T> binding, List<ProvisionListener> listeners) {
    this.binding = binding;
    if (listeners.isEmpty()) {
        this.listeners = EMPTY_LISTENER;
    } else {/* w  w  w  .  j  a v  a  2  s.co  m*/
        Set<ProvisionListener> deDuplicated = Sets.newLinkedHashSet(listeners);
        this.listeners = deDuplicated.toArray(new ProvisionListener[deDuplicated.size()]);
    }
}

From source file:com.github.fge.jsonschema.keyword.validator.draftv4.RequiredKeywordValidator.java

@Override
public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report,
        final MessageBundle bundle, final FullData data) throws ProcessingException {
    final Set<String> set = Sets.newLinkedHashSet(required);
    set.removeAll(Sets.newHashSet(data.getInstance().getNode().fieldNames()));

    if (!set.isEmpty())
        report.error(newMsg(data, bundle, "err.common.object.missingMembers").put("required", required)
                .putArgument("missing", toArrayNode(set)));
}

From source file:org.jclouds.slicehost.compute.suppliers.SlicehostHardwareSupplier.java

@Override
public Set<? extends Hardware> get() {
    final Set<Hardware> hardware;
    logger.debug(">> providing hardware");
    hardware = Sets.newLinkedHashSet(Iterables.transform(sync.listFlavors(), flavorToHardware));
    logger.debug("<< hardware(%d)", hardware.size());
    return hardware;
}

From source file:org.jclouds.slicehost.compute.suppliers.SlicehostImageSupplier.java

@Override
public Set<? extends Image> get() {
    Set<Image> images;
    logger.debug(">> providing images");
    images = Sets.newLinkedHashSet(Iterables.transform(sync.listImages(), slicehostImageToImage));
    logger.debug("<< images(%d)", images.size());
    return images;
}