Here you can find the source of cleanList(List
private static int cleanList(List<Point> blueList, Polygon borders)
//package com.java2s; //License from project: Open Source License import java.awt.Point; import java.awt.Polygon; import java.util.List; public class Main { private static int cleanList(List<Point> blueList, Polygon borders) { int numRemoved = 0; for (int i = 0; i < blueList.size(); i++) { Point currentPoint = blueList.get(i); if (borders.contains(currentPoint)) { blueList.remove(i);/*from w ww . j a va 2s .c om*/ i--; numRemoved++; } } return numRemoved; } }