本文整理汇总了Java中org.apache.commons.collections.list.SetUniqueList类的典型用法代码示例。如果您正苦于以下问题:Java SetUniqueList类的具体用法?Java SetUniqueList怎么用?Java SetUniqueList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SetUniqueList类属于org.apache.commons.collections.list包,在下文中一共展示了SetUniqueList类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeDuplicateProcesses
import org.apache.commons.collections.list.SetUniqueList; //导入依赖的package包/类
@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);
}
}
示例2: setDbFileList
import org.apache.commons.collections.list.SetUniqueList; //导入依赖的package包/类
public static void setDbFileList(List<DbFile> list) {
PreferenceModel model = SbApp.getInstance().getPreferenceModel();
Session session = model.beginTransaction();
PreferenceDAOImpl dao = new PreferenceDAOImpl(session);
@SuppressWarnings("unchecked")
List<DbFile> uniqueList = (List<DbFile>) SetUniqueList.decorate(list);
try {
if (uniqueList.size() > 10) {
uniqueList = uniqueList.subList(uniqueList.size() - 10,
uniqueList.size());
}
} catch (IndexOutOfBoundsException e) {
// ignore
}
String val = StringUtils.join(uniqueList, "#");
dao.saveOrUpdate(PreferenceKey.RECENT_FILES.toString(), val);
model.commit();
}
示例3: createRandomIndividual
import org.apache.commons.collections.list.SetUniqueList; //导入依赖的package包/类
@Override
public Team createRandomIndividual() {
Map<Position, Player> teamPlayers;
do {
teamPlayers = new LinkedHashMap<>();
SetUniqueList uniq = SetUniqueList.decorate(new ArrayList<>());
Player player;
for (Position p : Position.values()) {
while (! uniq.add(player = Player.getRandomPlayer(p.role))) {}
teamPlayers.put(p, player);
}
} while (!TeamValidator.validate(teamPlayers));
return new Team(teamPlayers);
}
示例4: createIndividual
import org.apache.commons.collections.list.SetUniqueList; //导入依赖的package包/类
@Override
public Team createIndividual(Team t, int genIdx) {
Map<Position, Player> teamPlayers;
int tries = 100;
boolean valid = false;
do {
SetUniqueList uniq = SetUniqueList.decorate(new ArrayList<>());
for (Player pl : t) {
uniq.add(pl);
}
teamPlayers = new LinkedHashMap<>();
Position pos;
Player player;
Iterator<Player> i = t.iterator();
int j = 0;
for (Iterator<Position> positions = Arrays.asList(Position.values()).iterator();
j < t.size(); j++) {
pos = positions.next();
if (genIdx == j) {
i.next();
while (! uniq.add(player = Player.getRandomPlayer(pos.role))) {}
} else {
player = i.next();
}
teamPlayers.put(pos, player);
}
} while (!(valid = TeamValidator.validate(teamPlayers)) && (0 < --tries));
return valid ? new Team(teamPlayers) : null;
}
示例5: Persona
import org.apache.commons.collections.list.SetUniqueList; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Persona() {
this.pageId = null;
this.hostPatternKey = null;
this.usernames = (List<String>)SetUniqueList.decorate(new ArrayList<String>());
}
示例6: searchForQuantitationTypes
import org.apache.commons.collections.list.SetUniqueList; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings({"unchecked", "PMD.ExcessiveMethodLength", "PMD.NPathComplexity" })
public List<QuantitationType> searchForQuantitationTypes(PageSortParams<QuantitationType> params,
QuantitationTypeSearchCriteria criteria) {
final Criteria c = getCurrentSession().createCriteria(HybridizationData.class);
c.createCriteria("hybridization").add(Restrictions.eq("id", criteria.getHybridization().getId()));
c.createCriteria("dataSet").createAlias("quantitationTypes", "qt").createAlias("arrayData", "ad");
c.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);
if (!criteria.getArrayDataTypes().isEmpty()) {
final List<Long> ids = new LinkedList<Long>();
for (final ArrayDataType type : criteria.getArrayDataTypes()) {
ids.add(type.getId());
}
c.createCriteria("ad.type").add(Restrictions.in("id", ids));
}
if (!criteria.getFileTypes().isEmpty() || !criteria.getFileCategories().isEmpty()) {
c.createAlias("ad.dataFile", "df");
}
if (!criteria.getFileTypes().isEmpty()) {
c.add(Restrictions.in("df.type",
Sets.newHashSet(FileTypeRegistryImpl.namesForTypes(criteria.getFileTypes()))));
}
if (!criteria.getFileCategories().isEmpty()) {
final Disjunction categoryCriterion = Restrictions.disjunction();
if (criteria.getFileCategories().contains(FileCategory.DERIVED_DATA)) {
categoryCriterion.add(Restrictions.in("df.type", Sets.newHashSet(FileTypeRegistryImpl
.namesForTypes(this.typeRegistry.getDerivedArrayDataTypes()))));
}
if (criteria.getFileCategories().contains(FileCategory.RAW_DATA)) {
categoryCriterion.add(Restrictions.in("df.type",
Sets.newHashSet(FileTypeRegistryImpl.namesForTypes(this.typeRegistry.getRawArrayDataTypes()))));
}
c.add(categoryCriterion);
}
c.setFirstResult(params.getIndex());
if (params.getPageSize() > 0) {
c.setMaxResults(params.getPageSize());
}
c.addOrder(toOrder(params, "qt"));
final List<Map<String, Object>> results = c.list();
final List<QuantitationType> qTypes = SetUniqueList.decorate(new LinkedList<QuantitationType>());
for (final Map<String, Object> row : results) {
final QuantitationType qt = (QuantitationType) row.get("qt");
qTypes.add(qt);
}
return qTypes;
}