HashSet is empty

Why is my HashSet<Circle> empty?

    LatLng currentLocation = new LatLng(mCurrentLocation.getLatitude(),mCurrentLocation.getLongitude());
    GoogleMap googleMap = mSupportMapFragment.getMap();

    HashSet<Circle> circles = new HashSet<>();

    if (!circles.isEmpty()) {
        for (Circle circle : circles) {
            Toast.makeText(getActivity(), "" + circles.size(), Toast.LENGTH_SHORT).show();
            if (!circle.getCenter().equals(currentLocation)) {
                circle.remove();
                circles.remove(circle);
            }
        }
    }

    Log.d(TAG_MAP, "" + circles.isEmpty() + " " + circles.size());

    Circle circle = googleMap.addCircle(new CircleOptions()
            .radius(CONSTANT.RADIUS)
            .strokeColor(Color.parseColor(CONSTANT.RADIUS_COLOR))
            .strokeWidth(CONSTANT.RADIUS_BORDER)
            .center(currentLocation));

    circles.add(circle);

I mean I even added a Circle object to it. I don't know what's wrong. Plus the circle gets drawn on my map

Jon Skeet
people
quotationmark

You're creating a new - and empty - set each time the code runs:

HashSet<Circle> circles = new HashSet<>();
if (!circles.isEmpty()) {
    // You'll never get in here...
}

If you want to maintain the same set across calls, you'll need it to be a field, not a local variable.

people

See more on this question at Stackoverflow