Example usage for org.apache.commons.collections.list SetUniqueList decorate

List of usage examples for org.apache.commons.collections.list SetUniqueList decorate

Introduction

In this page you can find the example usage for org.apache.commons.collections.list SetUniqueList decorate.

Prototype

public static SetUniqueList decorate(List list) 

Source Link

Document

Factory method to create a SetList using the supplied list to retain order.

Usage

From source file:com.evrythng.thng.resource.model.store.ListBasedAdiInputParameters.java

public void setInputData(final List<RedirectionResource> inputData) {

    this.inputData = inputData != null ? SetUniqueList.decorate(new ArrayList(inputData)) : null;
}

From source file:ListExampleV1.java

private void createLists() {
    uniqueList = SetUniqueList.decorate(new TreeList());
    cursorList = new CursorableLinkedList();
}

From source file:com.evrythng.thng.resource.model.core.ScopeResource.java

public void setUsers(final List<String> users) {

    this.users = users != null ? SetUniqueList.decorate(new ArrayList(users)) : null;
}

From source file:com.evrythng.thng.resource.model.core.ScopeResource.java

public void setProjects(final List<String> projects) {

    this.projects = projects != null ? SetUniqueList.decorate(new ArrayList(projects)) : null;
}

From source file:com.redhat.persistence.oql.MultiMap.java

private List allocateValues() {
    if (m_free.isEmpty()) {
        return SetUniqueList.decorate(new ArrayList());
    } else {//from ww  w. java2 s  .  c om
        List result = (List) m_free.remove(m_free.size() - 1);
        result.clear();
        return result;
    }
}

From source file:net.sourceforge.atunes.kernel.modules.favorites.FavoritesArtistsManager.java

/**
 * Takes artists from a list of audio objects and add or remove artists from
 * favorites//from  w  w  w  . ja  v  a 2s. c  o m
 * 
 * @param favorites
 * @param songs
 * @return if favorites have changed
 */
public boolean toggleFavoriteArtists(final IFavorites favorites, final List<ILocalAudioObject> songs) {
    if (CollectionUtils.isEmpty(songs)) {
        return false;
    }

    @SuppressWarnings("unchecked")
    Set<ILocalAudioObject> set = SetUniqueList.decorate(songs).asSet();

    Set<IArtist> toRemove = new HashSet<IArtist>();
    Set<IArtist> toAdd = new HashSet<IArtist>();
    for (ILocalAudioObject f : set) {
        IArtist artist = this.repositoryHandler.getArtist(f.getArtist(this.unknownObjectChecker));
        if (artist == null) {
            artist = this.repositoryHandler.getArtist(f.getAlbumArtist(this.unknownObjectChecker));
        }
        if (artist != null) {
            if (favorites.containsArtist(artist)) {
                toRemove.add(artist);
            } else {
                toAdd.add(artist);
            }
        }
    }

    addArtists(favorites, toAdd);
    removeArtists(favorites, toRemove);

    return !toRemove.isEmpty() || !toAdd.isEmpty();
}

From source file:net.sourceforge.atunes.kernel.modules.favorites.FavoritesAlbumsManager.java

/**
 * Takes albums from a list of audio objects and add or remove albums from
 * favorites/*  www . j a  v a  2 s.co m*/
 * 
 * @param favorites
 * @param songs
 * @return if favorites have changed
 */
public boolean toggleFavoriteAlbums(final IFavorites favorites, final List<ILocalAudioObject> songs) {
    if (CollectionUtils.isEmpty(songs)) {
        return false;
    }

    @SuppressWarnings("unchecked")
    Set<ILocalAudioObject> set = SetUniqueList.decorate(songs).asSet();

    Set<IAlbum> toAdd = new HashSet<IAlbum>();
    Set<IAlbum> toRemove = new HashSet<IAlbum>();
    for (ILocalAudioObject f : set) {
        IArtist artist = this.repositoryHandler.getArtist(f.getArtist(this.unknownObjectChecker));
        if (artist == null) {
            artist = this.repositoryHandler.getArtist(f.getAlbumArtist(this.unknownObjectChecker));
        }
        if (artist != null) {
            IAlbum album = artist.getAlbum(f.getAlbum(this.unknownObjectChecker));
            if (album != null) {
                if (favorites.containsAlbum(album)) {
                    toRemove.add(album);
                } else {
                    toAdd.add(album);
                }
            }
        }
    }

    addAlbums(favorites, toAdd);
    removeAlbums(favorites, toRemove);

    return !toRemove.isEmpty() || !toAdd.isEmpty();
}

From source file:com.evrythng.thng.resource.model.store.Project.java

public void setShortDomains(final List<String> shortDomains) {

    this.shortDomains = shortDomains != null ? SetUniqueList.decorate(new ArrayList(shortDomains)) : null;
}

From source file:com.evrythng.thng.resource.model.core.ResourceModel.java

public void setTags(final List<String> tags) {

    this.tags = tags != null ? SetUniqueList.decorate(new ArrayList(tags)) : null;
}

From source file:fr.fastconnect.factory.tibco.bw.maven.compile.ArchiveBuilder.java

@SuppressWarnings("unchecked") // TODO: switch to Apache Commons 4.0+
public void removeDuplicateProcesses() {
    ElementNSImpl mergedEnterpriseArchive = (ElementNSImpl) this.repository.getAny().get(0);
    ElementNSImpl mergedProcessArchive = getElement(mergedEnterpriseArchive, "processArchive");
    ElementNSImpl mergedProcessProperty = getElement(mergedProcessArchive, "processProperty");

    String content = mergedProcessProperty.getTextContent();
    if (content != null && !content.isEmpty()) {
        List<String> processes = SetUniqueList.decorate(new ArrayList<String>());
        processes.addAll(Arrays.asList(content.split(",")));
        String contentWithoutDuplicate = StringUtils.join(processes, ",");
        mergedProcessProperty.setTextContent(contentWithoutDuplicate);
    }/*from w  ww.  j  a va  2 s . c om*/

}