当前位置: 首页>>代码示例>>Java>>正文


Java ArrayList.removeAll方法代码示例

本文整理汇总了Java中java.util.ArrayList.removeAll方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayList.removeAll方法的具体用法?Java ArrayList.removeAll怎么用?Java ArrayList.removeAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.ArrayList的用法示例。


在下文中一共展示了ArrayList.removeAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onUpgrade

import java.util.ArrayList; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    Log.d("DB_UPGRADE", "Updating " + AppChoiceTable.NAME + " table to version " +
                        newVersion + " from version " + oldVersion);
    Cursor cursor = db.query(AppChoiceTable.NAME, null, null, null, null, null, null);
    ArrayList<String> existentColumns = new ArrayList<>(Arrays.asList(cursor.getColumnNames()));
    cursor.close();
    ArrayList<String> missingColumns = AppChoiceTable.Cols.NAME_LIST;
    missingColumns.removeAll(existentColumns);

    try {
        for (String columnName : missingColumns) {
            Log.d("DB_UPGRADE", "Adding column " + columnName + " to table using: " +
                    mDbAlterCommands.get(columnName));
            db.execSQL(mDbAlterCommands.get(columnName));
        }
    } catch (Exception e) {
        Log.e("DB_UPGRADE", "Failed to upgrade DB: " + e.getMessage());
        Toast.makeText(mContext, "App update has an issue! Please send logs to developer!", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:22,代码来源:AppSelectionDbHelper.java

示例2: getIntersectionPoints

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * Gets the intersection points.
 *
 * @param line
 *          the line
 * @param rectangle
 *          the rectangle
 * @return the intersection points
 */
public static List<Point2D> getIntersectionPoints(final Line2D line, final Rectangle2D rectangle) {
  final ArrayList<Point2D> intersectionPoints = new ArrayList<>();
  final Line2D[] lines = getLines(rectangle);
  final Line2D topLine = lines[0];
  final Line2D bottomLine = lines[1];
  final Line2D leftLine = lines[2];
  final Line2D rightLine = lines[3];

  // Top line
  final Point2D p1 = getIntersectionPoint(line, topLine);
  if (p1 != null && contains(rectangle, p1)) {
    intersectionPoints.add(p1);
  }

  // Bottom line
  final Point2D p2 = getIntersectionPoint(line, bottomLine);
  if (p2 != null && contains(rectangle, p2) && !intersectionPoints.contains(p2)) {
    intersectionPoints.add(p2);
  }

  // Left side...
  final Point2D p3 = getIntersectionPoint(line, leftLine);
  if (p3 != null && !p3.equals(p1) && !p3.equals(p2) && contains(rectangle, p3) && !intersectionPoints.contains(p3)) {
    intersectionPoints.add(p3);
  }

  // Right side
  final Point2D p4 = getIntersectionPoint(line, rightLine);
  if (p4 != null && !p4.equals(p1) && !p4.equals(p2) && contains(rectangle, p4) && !intersectionPoints.contains(p4)) {
    intersectionPoints.add(p4);
  }

  intersectionPoints.removeAll(Collections.singleton(null));
  return intersectionPoints;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:45,代码来源:GeometricUtilities.java

示例3: preProcess

import java.util.ArrayList; //导入方法依赖的package包/类
private void preProcess()
{
    ArrayList<Box> boxes = model.model.getElements();
    HashSet<Box> subBoxes = Sets.newHashSet();
    for (Box box : boxes)
    {
        if (subBoxes.contains(box)) continue;
        Rotation rotation = box.getRotation();
        for (Box box1 : boxes)
        {
            if (box == box1 || subBoxes.contains(box1)) continue;
            Rotation rotation1 = box.getRotation();

            boolean sameRot = rotation == null && rotation1 == null;
            if (!sameRot) sameRot = rotation != null && rotation.equals(rotation1);
            if (sameRot && isSubBox(box, box1))
            {
                subBoxes.add(box1);
            }
        }
    }
    boxes.removeAll(subBoxes);
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:24,代码来源:JsonConverter.java

示例4: assignLocations

import java.util.ArrayList; //导入方法依赖的package包/类
private void assignLocations(ArrayList<LIRInstruction> instructions) {
    int numInst = instructions.size();
    boolean hasDead = false;

    for (int j = 0; j < numInst; j++) {
        final LIRInstruction op = instructions.get(j);
        if (op == null) {
            /*
             * this can happen when spill-moves are removed in eliminateSpillMoves
             */
            hasDead = true;
        } else if (assignLocations(op)) {
            instructions.set(j, null);
            hasDead = true;
        }
    }

    if (hasDead) {
        // Remove null values from the list.
        instructions.removeAll(Collections.singleton(null));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:LinearScanAssignLocationsPhase.java

示例5: getControls

import java.util.ArrayList; //导入方法依赖的package包/类
public Component getControls() {
  ArrayList<String> availableSides = new ArrayList<String>(sides);
  ArrayList<String> alreadyTaken = new ArrayList<String>();

  for (PlayerInfo p : players) {
    alreadyTaken.add(p.side);
  }

  availableSides.removeAll(alreadyTaken);
  availableSides.add(0, translatedObserver);
  sideConfig = new StringEnumConfigurer(null,
    Resources.getString("PlayerRoster.join_game_as"), //$NON-NLS-1$
    availableSides.toArray(new String[availableSides.size()]));
  sideConfig.setValue(translatedObserver);
  return sideConfig.getControls();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:17,代码来源:PlayerRoster.java

示例6: removeStopWordsRemoveAll

import java.util.ArrayList; //导入方法依赖的package包/类
public static void removeStopWordsRemoveAll(String text){
	//******************EXAMPLE WITH REMOVE ALL *******************************************************************************************

	try {
		out.println(text);
		Scanner stopWordList = new Scanner(new File("C://Jenn Personal//Packt Data Science//Chapter 3 Data Cleaning//stopwords.txt"));
		TreeSet<String> stopWords = new TreeSet<String>();
		while(stopWordList.hasNextLine()){
			stopWords.add(stopWordList.nextLine());
		}
		ArrayList<String> dirtyText = new ArrayList<String>(Arrays.asList(text.split(" ")));
		dirtyText.removeAll(stopWords);
		out.println("Clean words: ");
		for(String x : dirtyText){
			out.print(x + " ");
		}
		out.println();
		stopWordList.close();
	} catch (FileNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Made-Easy,代码行数:24,代码来源:SimpleStringCleaning.java

示例7: fold

import java.util.ArrayList; //导入方法依赖的package包/类
/** Merge "a" into the set of entries.
 *
 * <p>  If {a}+this.entries contain a set of entries X1..Xn, such that
 * <br>   (1) For each X:  X[j]==a[j] for i!=j, and X[i].super==a[i].super
 * <br>   (2) X1[i]..Xn[i] exhaust all the direct subsignatures of an abstract parent sig
 * <br> THEN:
 * <br>   we remove X1..Xn, then return the merged result of X1..Xn
 * <br> ELSE
 * <br>   we change nothing, and simply return null
 *
 * <p><b>Precondition:</b> a[i] is not NONE, and a[i].parent is abstract, and a[i].parent!=UNIV
 */
private static List<PrimSig> fold(ArrayList<List<PrimSig>> entries, List<PrimSig> a, int i) {
    PrimSig parent = a.get(i).parent;
    SafeList<PrimSig> children;
    try { children=parent.children(); } catch(Err ex) { return null; } // Exception only occurs if a[i].parent==UNIV
    List<PrimSig> subs = children.makeCopy();
    ArrayList<List<PrimSig>> toDelete = new ArrayList<List<PrimSig>>();
    for(int bi=entries.size()-1; bi>=0; bi--) {
        List<PrimSig> b=entries.get(bi);
        if (b.size() == a.size()) {
            for(int j=0; ;j++) {
                if (j>=b.size()) {toDelete.add(b); subs.remove(b.get(i)); break;}
                PrimSig bt1=a.get(j), bt2=b.get(j);
                if (i==j && bt2.parent!=parent) break;
                if (i!=j && bt2!=bt1) break;
            }
        }
    }
    subs.remove(a.get(i));
    if (subs.size()!=0) return null;
    entries.removeAll(toDelete);
    entries.remove(a);
    a=new ArrayList<PrimSig>(a);
    a.set(i, parent);
    return a;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:38,代码来源:Type.java

示例8: getFansList

import java.util.ArrayList; //导入方法依赖的package包/类
public ArrayList getFansList(){
    if(followersList==null||followingList==null){
        getFollowingList();
        getFollowersList();
    }
    ArrayList fansList = new ArrayList();
    for (InstagramUserSummary user : users) {
        fansList.add(user.getUsername());
    }
    fansList.removeAll(followingList);
    return fansList;
}
 
开发者ID:ozankaraali,项目名称:InstaManager,代码行数:13,代码来源:Instaman.java

示例9: removeAll

import java.util.ArrayList; //导入方法依赖的package包/类
@Override
public synchronized boolean removeAll(Collection<?> c) {
  ArrayList<E> newList = new ArrayList<E>(list);
  // Removals in ArrayList won't break sorting
  boolean changed = newList.removeAll(c);
  list = Collections.unmodifiableList(newList);
  return changed;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:SortedList.java

示例10: get

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * Why does this method resort to returning via exceptional-control-flow upon detecting a cancellation request?
 * Didn't the validation method already handle it?
 * <p>
 * Upon cancellation, some validators (for example, {@code ManifestAwareResourceValidator}) may decide to stop all
 * work and return only the issues found thus far (or even an empty list of issues). That's a valid realization of
 * the cancellation contract. Thus the {@code validate()} method returned normally. If we were to return those
 * partial results, the caller of this method would proceed to pollute the cache with them. That's prevented by
 * throwing a fabricated {@link OperationCanceledError}
 */
@Override
public List<Issue> get() throws OperationCanceledError {
	operationCanceledManager.checkCanceled(ci);
	List<Issue> issues = rv.validate(r, CheckMode.ALL, ci);
	if (!issues.contains(null)) {
		operationCanceledManager.checkCanceled(ci);
		return issues;
	}
	ArrayList<Issue> result = new ArrayList<>(issues);
	result.removeAll(Collections.singleton(null));
	operationCanceledManager.checkCanceled(ci);
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:IssuesProvider.java

示例11: assignBlock

import java.util.ArrayList; //导入方法依赖的package包/类
@SuppressWarnings("try")
private void assignBlock(AbstractBlockBase<?> block) {
    DebugContext debug = allocator.getDebug();
    try (Indent indent2 = debug.logAndIndent("assign locations in block B%d", block.getId())) {
        ArrayList<LIRInstruction> instructions = allocator.getLIR().getLIRforBlock(block);
        handleBlockBegin(block, instructions);
        int numInst = instructions.size();
        boolean hasDead = false;

        for (int j = 0; j < numInst; j++) {
            final LIRInstruction op = instructions.get(j);
            if (op == null) {
                /*
                 * this can happen when spill-moves are removed in eliminateSpillMoves
                 */
                hasDead = true;
            } else if (assignLocations(op, instructions, j)) {
                hasDead = true;
            }
        }
        handleBlockEnd(block, instructions);

        if (hasDead) {
            // Remove null values from the list.
            instructions.removeAll(Collections.singleton(null));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:TraceLinearScanAssignLocationsPhase.java

示例12: removeURLs

import java.util.ArrayList; //导入方法依赖的package包/类
/** Removes few URLs.
 */
public void removeURLs(Collection<URL> urls) throws Exception {
    if (urls.contains(null)) {
        throw new NullPointerException("urls=" + urls);
    }
    ArrayList<URL> arr = new ArrayList<URL>();
    if (this.prevs != null) {
        arr.addAll(this.prevs);
    }
    arr.removeAll(urls);
    setURLs(arr);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ModuleLayeredFileSystem.java

示例13: removeData_static

import java.util.ArrayList; //导入方法依赖的package包/类
/** Remove data
* 
* See {@link IBspStrategy#removeData(Object, Object)}
*/
  public static <TElement> ArrayList<TElement> removeData_static( ArrayList<TElement> data, ArrayList<TElement> dataToRemove ) {
  	if ( data == null ) {
  		return null;
  	}
  	
  	ArrayList<TElement> pruned = Lists.newArrayList( data );
  	
  	if ( dataToRemove != null ) {
  		pruned.removeAll( dataToRemove );
  	}
  	
  	return pruned;
  }
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:18,代码来源:BspListDataStrategy.java

示例14: promptForSide

import java.util.ArrayList; //导入方法依赖的package包/类
protected String promptForSide() {
    ArrayList<String> availableSides = new ArrayList<String>(sides);
    ArrayList<String> alreadyTaken = new ArrayList<String>();

    for (PlayerInfo p : players) {
      alreadyTaken.add(p.side);
    }

    availableSides.removeAll(alreadyTaken);
    availableSides.add(0, translatedObserver);

    final GameModule g = GameModule.getGameModule();
    String newSide = (String) JOptionPane.showInputDialog(
      g.getFrame(),
      Resources.getString("PlayerRoster.join_game_as"), //$NON-NLS-1$
      Resources.getString("PlayerRoster.choose_side"), //$NON-NLS-1$
      JOptionPane.QUESTION_MESSAGE,
      null,
      availableSides.toArray(new String[availableSides.size()]),
      translatedObserver
    );

    // OBSERVER must always be stored internally in English.
    if (translatedObserver.equals(newSide)) {
      newSide = OBSERVER;
    }
    return newSide;
/*
    if (newSide != null) {
      final PlayerInfo me = new PlayerInfo(GameModule.getUserId(), GlobalOptions.getInstance().getPlayerId(), newSide);
      final Add a = new Add(this, me.playerId, me.playerName, me.side);
      a.execute();
      g.getServer().sendToOthers(a);
    }
*/
  }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:37,代码来源:PlayerRoster.java

示例15: removeStopWords

import java.util.ArrayList; //导入方法依赖的package包/类
public static void removeStopWords(String text){
	//discuss stop words file - how to choose stop words? use whole alphabet as way to handle I'M --> I M

	//****************** SIMPLE EXAMPLE *******************************************************************************************

	try {
		//read in list of stop words
		Scanner readStop = new Scanner(new File("C://Jenn Personal//Packt Data Science//Chapter 3 Data Cleaning//stopwords.txt"));
		//create an ArrayList to hold dirty text - call simpleCleanToArray to perform basic cleaning and put in array first
		ArrayList<String> words = new ArrayList<String>(Arrays.asList(simpleCleanToArray(text)));
		//loop through stop words file and check array for each word
		out.println("Original clean text: " + words.toString());
		ArrayList<String> foundWords = new ArrayList();
		while(readStop.hasNextLine()){
			String stopWord = readStop.nextLine().toLowerCase();
			if(words.contains(stopWord)){
				foundWords.add(stopWord);
			}
		}
		words.removeAll(foundWords);
		out.println("Text without stop words: " + words.toString());
	} catch (FileNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Made-Easy,代码行数:28,代码来源:SimpleStringCleaning.java


注:本文中的java.util.ArrayList.removeAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。