本文整理匯總了Java中java.util.List.removeAll方法的典型用法代碼示例。如果您正苦於以下問題:Java List.removeAll方法的具體用法?Java List.removeAll怎麽用?Java List.removeAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.List
的用法示例。
在下文中一共展示了List.removeAll方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: PgDumper
import java.util.List; //導入方法依賴的package包/類
public PgDumper(String exePgdump, String customParams,
String host, int port, String user, String pass,
String dbname, String encoding, String timezone, String dumpFile) {
this.exePgdump = exePgdump;
this.host = host;
this.port = port;
this.user = user;
this.pass = pass;
this.dbname = dbname;
this.encoding = encoding;
this.timezone = timezone;
this.dumpFile = dumpFile;
List<String> listCustom = new ArrayList<>(Arrays.asList(customParams.split(" "))); //$NON-NLS-1$
listCustom.removeAll(Arrays.asList("")); //$NON-NLS-1$
this.customParams = Collections.unmodifiableList(listCustom);
}
示例2: findOperationsByRoleId
import java.util.List; //導入方法依賴的package包/類
@Override
public List<Operation> findOperationsByRoleId(int roleId){
recRole = new ArrayList<Role>() ;
roleOperation = new ArrayList<Operation>();
roleOperation = roleService.findOperationByRoleId(roleId);
for(Operation o :roleOperation){
o.setState(true);
}
Role r = roleService.find(roleId);
if(r.getRoleExtendPId()>=0){
findRolesByRoleId(r.getRoleExtendPId());
}
for(Role r1 :recRole){
List<Operation> opera = roleService.findOperationByRoleId(r1.getId());
opera.removeAll(roleOperation); // 移除所有和operations中一致的操作
roleOperation.addAll(opera); //將剩餘操作加入集合中
}
return roleOperation;
}
示例3: movePayloadTypesToFront
import java.util.List; //導入方法依賴的package包/類
private static String movePayloadTypesToFront(List<String> preferredPayloadTypes, String mLine) {
// The format of the media description line should be: m=<media> <port> <proto> <fmt> ...
final List<String> origLineParts = Arrays.asList(mLine.split(" "));
if (origLineParts.size() <= 3) {
Log.e(TAG, "Wrong SDP media description format: " + mLine);
return null;
}
final List<String> header = origLineParts.subList(0, 3);
final List<String> unpreferredPayloadTypes =
new ArrayList<String>(origLineParts.subList(3, origLineParts.size()));
unpreferredPayloadTypes.removeAll(preferredPayloadTypes);
// Reconstruct the line with |preferredPayloadTypes| moved to the beginning of the payload
// types.
final List<String> newLineParts = new ArrayList<String>();
newLineParts.addAll(header);
newLineParts.addAll(preferredPayloadTypes);
newLineParts.addAll(unpreferredPayloadTypes);
return joinString(newLineParts, " ", false /* delimiterAtEnd */);
}
示例4: testFileHandlerClose
import java.util.List; //導入方法依賴的package包/類
private static void testFileHandlerClose(File writableDir) throws IOException {
File fakeLock = new File(writableDir, "log.log.lck");
if (!createFile(fakeLock, false)) {
throw new IOException("Can't create fake lock file: " + fakeLock);
}
try {
List<File> before = listLocks(writableDir, true);
System.out.println("before: " + before.size() + " locks found");
FileHandler handler = createFileHandler(writableDir);
System.out.println("handler created: " + handler);
List<File> after = listLocks(writableDir, true);
System.out.println("after creating handler: " + after.size() + " locks found");
handler.close();
System.out.println("handler closed: " + handler);
List<File> afterClose = listLocks(writableDir, true);
System.out.println("after closing handler: " + afterClose.size() + " locks found");
afterClose.removeAll(before);
if (!afterClose.isEmpty()) {
throw new RuntimeException("Zombie lock file detected: " + afterClose);
}
} finally {
if (fakeLock.canRead()) delete(fakeLock);
}
List<File> finalLocks = listLocks(writableDir, false);
System.out.println("After cleanup: " + finalLocks.size() + " locks found");
}
示例5: objectiveFunction
import java.util.List; //導入方法依賴的package包/類
public static double objectiveFunction(Map<String, Set<String>> goldData, Map<String, Set<String>> resultData) {
for (String abstarctID : goldData.keySet()) {
resultData.putIfAbsent(abstarctID, new HashSet<String>());
}
double macroF1 = 0;
for (String pubmedID : goldData.keySet()) {
macroF1 += PRF1Extended.macroF1(goldData.get(pubmedID), resultData.get(pubmedID)) / goldData.size();
JLink.log.info("DocumentID = " + pubmedID);
JLink.log.info("Findings = " + resultData.get(pubmedID));
JLink.log.info("Gold = " + goldData.get(pubmedID));
JLink.log.info("Precision: " + macroPrecision(goldData.get(pubmedID), resultData.get(pubmedID)));
JLink.log.info("Recall: " + macroRecall(goldData.get(pubmedID), resultData.get(pubmedID)));
JLink.log.info("F1: " + macroF1(goldData.get(pubmedID), resultData.get(pubmedID)));
List<String> x = new ArrayList<>(goldData.get(pubmedID));
x.removeAll(resultData.get(pubmedID));
List<String> y = new ArrayList<>(resultData.get(pubmedID));
y.removeAll(goldData.get(pubmedID));
JLink.log.info("Missing: " + x);
JLink.log.info("To much: " + y);
JLink.log.info("");
}
return macroF1;
}
示例6: testFoo
import java.util.List; //導入方法依賴的package包/類
@Test
public void testFoo() {
List<MyFibre> fibres = new ArrayList<>();
List<MyFibre> fibres2 = new ArrayList<>();
MyFibreType myFibreType = new MyFibreType();
for (int i = 0; i < 4000000; i++) {
MyFibre fib = new MyFibre("LogicalId", myFibreType);
fibres.add(fib);
fibres2.add(fib);
}
fibres.removeAll(fibres2);
}
示例7: initGui
import java.util.List; //導入方法依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
this.buttonList.add(new GuiOptionButton(2, this.width / 2 - 154, this.height - 48, I18n.format("resourcePack.openFolder", new Object[0])));
this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 4, this.height - 48, I18n.format("gui.done", new Object[0])));
if (!this.changed)
{
this.availableResourcePacks = Lists.<ResourcePackListEntry>newArrayList();
this.selectedResourcePacks = Lists.<ResourcePackListEntry>newArrayList();
ResourcePackRepository resourcepackrepository = this.mc.getResourcePackRepository();
resourcepackrepository.updateRepositoryEntriesAll();
List<ResourcePackRepository.Entry> list = Lists.newArrayList(resourcepackrepository.getRepositoryEntriesAll());
list.removeAll(resourcepackrepository.getRepositoryEntries());
for (ResourcePackRepository.Entry resourcepackrepository$entry : list)
{
this.availableResourcePacks.add(new ResourcePackListEntryFound(this, resourcepackrepository$entry));
}
for (ResourcePackRepository.Entry resourcepackrepository$entry1 : Lists.reverse(resourcepackrepository.getRepositoryEntries()))
{
this.selectedResourcePacks.add(new ResourcePackListEntryFound(this, resourcepackrepository$entry1));
}
this.selectedResourcePacks.add(new ResourcePackListEntryDefault(this));
}
this.availableResourcePacksList = new GuiResourcePackAvailable(this.mc, 200, this.height, this.availableResourcePacks);
this.availableResourcePacksList.setSlotXBoundsFromLeft(this.width / 2 - 4 - 200);
this.availableResourcePacksList.registerScrollButtons(7, 8);
this.selectedResourcePacksList = new GuiResourcePackSelected(this.mc, 200, this.height, this.selectedResourcePacks);
this.selectedResourcePacksList.setSlotXBoundsFromLeft(this.width / 2 + 4);
this.selectedResourcePacksList.registerScrollButtons(7, 8);
}
示例8: doRetrieveRooster
import java.util.List; //導入方法依賴的package包/類
@Override
public void doRetrieveRooster(MessageContext context) {
User user = getContextUser(context);
Set<User> contacts = new HashSet<User>(user.getContacts());
Set<User> invited = new HashSet<User>(contacts);
List<User> inverseRooster = getWhoAdded(user);
invited.removeAll(inverseRooster);
contacts.retainAll(inverseRooster);
inverseRooster.removeAll(contacts);
HubMessage msg = new HubMessage(HubMessage.TYPE_ACK, HubMessage.TYPE_REQUEST_ROOSTER);
JSONSerializer serializer = createSerializer();
StringBuilder builder = new StringBuilder();
builder.append("[");
builder.append(serializer.deepSerialize(invited)); // Users that I invited but have not added me.
builder.append(",");
builder.append(serializer.deepSerialize(contacts)); // Users present for game. Added and added back
builder.append(",");
builder.append(serializer.deepSerialize(inverseRooster)); // Users that have added me but I have not added back.
builder.append("]");
msg.setPayload(builder.toString());
msg.addTo(user.getEmail());
messageService.sendMessage(context, msg);
}
示例9: isSuitable
import java.util.List; //導入方法依賴的package包/類
private static boolean isSuitable(Pattern pattern) {
List<String> wordTokensList = new ArrayList<>(Arrays.asList(pattern.naturalLanguageRepresentation.split(" ")));
List<String> posTagTokens = new ArrayList<>(Arrays.asList(pattern.posTags.split(" ")));
String[] wordTokens = pattern.naturalLanguageRepresentation.split(" ");
String[] tagTokens = pattern.posTags.split(" ");
// we want to remove the be forms and the corresponding pos tags
for (int i = 0; i < tagTokens.length; i++) {
if (wordTokens[i + 1].matches("(^\\p{Upper}.*|and)") || tagTokens[i].matches("(''|``|,|-RRB-|-LRB-|WP)")) {
wordTokensList.set(i + 1, null);
posTagTokens.set(i, null);
}
}
if (wordTokens[wordTokens.length - 2].equals("the"))
wordTokens[wordTokens.length - 2] = null;
wordTokensList.removeAll(Arrays.asList("", null));
posTagTokens.removeAll(Arrays.asList("", null));
pattern.naturalLanguageRepresentation = Joiner.on(" ").join(wordTokensList);
pattern.posTags = Joiner.on(" ").join(posTagTokens);
wordTokensList.removeAll(BE_TOKENS);
wordTokensList.remove("a");
wordTokensList.remove("?D?");
wordTokensList.remove("?R?");
// check if the patterns contains a verb other than be verbs
return posTagTokens.contains("VB") && wordTokensList.size() > 0;
}
示例10: execute
import java.util.List; //導入方法依賴的package包/類
@Override
public void execute(Context context, String arg) throws MissingArgumentException, IllegalCmdArgumentException {
if(arg == null) {
throw new MissingArgumentException();
}
List<String> splitArgs = StringUtils.split(arg, 2);
if(splitArgs.size() != 2) {
throw new MissingArgumentException();
}
Action action = Utils.getValueOrNull(Action.class, splitArgs.get(0));
if(action == null) {
throw new IllegalCmdArgumentException(String.format("`%s` is not a valid action. %s",
splitArgs.get(0), FormatUtils.formatOptions(Action.class)));
}
List<String> commands = StringUtils.split(splitArgs.get(1).toLowerCase());
List<String> unknownCmds = commands.stream().filter(cmd -> CommandManager.getCommand(cmd) == null).collect(Collectors.toList());
if(!unknownCmds.isEmpty()) {
throw new IllegalCmdArgumentException(String.format("Command %s doesn't exist.",
FormatUtils.format(unknownCmds, cmd -> String.format("`%s`", cmd), ", ")));
}
DBGuild dbGuild = Database.getDBGuild(context.getGuild());
List<String> blacklist = dbGuild.getBlacklistedCmd();
if(Action.ADD.equals(action)) {
blacklist.addAll(commands);
BotUtils.sendMessage(String.format(Emoji.CHECK_MARK + " Command(s) `%s` added to the blacklist.",
FormatUtils.format(commands, cmd -> String.format("`%s`", cmd), ", ")), context.getChannel());
} else if(Action.REMOVE.equals(action)) {
blacklist.removeAll(commands);
BotUtils.sendMessage(String.format(Emoji.CHECK_MARK + " Command(s) `%s` removed from the blacklist.",
FormatUtils.format(commands, cmd -> String.format("`%s`", cmd), ", ")), context.getChannel());
}
dbGuild.setSetting(this.getSetting(), new JSONArray(blacklist));
}
示例11: getRandomRelWithNumAttr
import java.util.List; //導入方法依賴的package包/類
protected RelationType getRandomRelWithNumAttr (boolean source, int numAttr,
Collection<RelationType> notThese) {
List<RelationType> cand = new ArrayList<RelationType> ();
for(RelationType r: model.getSchema(source).getRelationArray()) {
if (r.sizeOfAttrArray() == numAttr)
cand.add(r);
}
// remove the ones not allowed
cand.removeAll(notThese);
return pickRel(cand);
}
示例12: saveCookie
import java.util.List; //導入方法依賴的package包/類
@Override
public synchronized void saveCookie(HttpUrl url, Cookie cookie) {
List<Cookie> cookies = memoryCookies.get(url.host());
List<Cookie> needRemove = new ArrayList<>();
for (Cookie item : cookies) {
if (cookie.name().equals(item.name())) {
needRemove.add(item);
}
}
cookies.removeAll(needRemove);
cookies.add(cookie);
}
示例13: buffer
import java.util.List; //導入方法依賴的package包/類
/**
* create the new buffered layer
*/
public void buffer(double bufferingDistance) {
List<Geometry> bufferedGeom=glayer.getGeometries();
try {
bufferedGeom=parallelBuffer(bufferedGeom, bufferingDistance);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
// then merge them
List<Geometry> newgeoms = new ArrayList<Geometry>();
List<Geometry> remove = new ArrayList<Geometry>();
// if(bufferingDistance>0){
//ciclo sulle nuove geometrie
for (Geometry buffGeom : bufferedGeom) {
boolean isnew = true;
remove.clear();
for (Geometry newg : newgeoms) {
if (newg.contains(buffGeom)) { //se newg contiene g -> g deve essere rimossa
isnew = false;
break;
} else if (buffGeom.contains(newg)) { //se g contiene newg -> newg deve essere rimossa
remove.add(newg);
}
}
if (isnew) {
newgeoms.add(buffGeom);
}
newgeoms.removeAll(remove);
}
glayer.clear();
// assign new value
for (Geometry geom :newgeoms) {
glayer.put(geom);
}
// }
}
示例14: getNoProviders
import java.util.List; //導入方法依賴的package包/類
private List<String> getNoProviders() {
List<String> providerServices = providerDAO.findServices();
List<String> consumerServices = consumerDAO.findServices();
List<String> noProviderServices = new ArrayList<String>();
if (consumerServices != null) {
noProviderServices.addAll(consumerServices);
noProviderServices.removeAll(providerServices);
}
return noProviderServices;
}
示例15: BeperklijstMetInstantiesLigtVoor
import java.util.List; //導入方法依賴的package包/類
public static List<SNode> BeperklijstMetInstantiesLigtVoor(List<SNode> instantiesVanObject, SNode ligtVoor) {
List<SNode> result = instantiesVanObject;
List<SNode> teverwijderenInstanties = new ArrayList<SNode>();
SNode kenmerk = SConceptOperations.createNewNode(MetaAdapterFactory.getConcept(0x8dc4b25f4c49400eL, 0xac370fd230db702cL, 0x4916e0625cef8883L, "ObjectiefRecht.structure.Kenmerk"));
{
final SNode variabele = SLinkOperations.getTarget(ligtVoor, MetaAdapterFactory.getContainmentLink(0x8dc4b25f4c49400eL, 0xac370fd230db702cL, 0x46db58718361b134L, 0x46db58718361b135L, "expressie1"));
if (SNodeOperations.isInstanceOf(variabele, MetaAdapterFactory.getConcept(0x8dc4b25f4c49400eL, 0xac370fd230db702cL, 0x76ccb41bf386dd7eL, "ObjectiefRecht.structure.Variabele"))) {
kenmerk = SLinkOperations.getTarget(SLinkOperations.getTarget(variabele, MetaAdapterFactory.getContainmentLink(0x8dc4b25f4c49400eL, 0xac370fd230db702cL, 0x76ccb41bf386dd7eL, 0x1fabc0b15d875006L, "kenmerk")), MetaAdapterFactory.getReferenceLink(0x8dc4b25f4c49400eL, 0xac370fd230db702cL, 0x6e43a734f86e13f2L, 0x6e43a734f86e13f3L, "kenmerk"));
}
}
{
final SNode huidigeDatum = SLinkOperations.getTarget(ligtVoor, MetaAdapterFactory.getContainmentLink(0x8dc4b25f4c49400eL, 0xac370fd230db702cL, 0x46db58718361b134L, 0x46db58718361b137L, "expressie2"));
if (SNodeOperations.isInstanceOf(huidigeDatum, MetaAdapterFactory.getConcept(0x8dc4b25f4c49400eL, 0xac370fd230db702cL, 0x7dbb3ebc6b57f9e0L, "ObjectiefRecht.structure.HuidigeDatum"))) {
for (SNode instantieVanObject : ListSequence.fromList(result)) {
SNode datumWaarde = (SNode) InstantieVanObject__BehaviorDescriptor.GeefWaardeVanKenmerk_idFR9FxGLp3H.invoke(instantieVanObject, kenmerk);
LocalDate Datum = Datum__BehaviorDescriptor.geefdatum_id5riiL_BUg0c.invoke(SLinkOperations.getTarget(datumWaarde, MetaAdapterFactory.getContainmentLink(0x30ef095ad48945ffL, 0xa80f456a798ac125L, 0x1fabc0b15d9b6273L, 0x1fabc0b15d9b6274L, "waarde")));
Interpreter.voegBerichtToe("Ligt " + Datum + " voor " + LocalDate.now() + "?");
if (!(Datum.isBefore(LocalDate.now()))) {
Interpreter.voegBerichtToe(Datum + " ligt niet voor " + LocalDate.now());
teverwijderenInstanties.add(instantieVanObject);
}
}
}
}
result.removeAll(teverwijderenInstanties);
return result;
}