java - HashSet is empty -


why hashset<circle> empty?

    latlng currentlocation = new latlng(mcurrentlocation.getlatitude(),mcurrentlocation.getlongitude());     googlemap googlemap = msupportmapfragment.getmap();      hashset<circle> circles = new hashset<>();      if (!circles.isempty()) {         (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 added circle object it. don't know what's wrong. plus circle gets drawn on map

you're creating new - , empty - set each time code runs:

hashset<circle> circles = new hashset<>(); if (!circles.isempty()) {     // you'll never in here... } 

if want maintain same set across calls, you'll need field, not local variable.


Comments

  1. @admin

    We believe that whatever your dental needs may be, you will be treated with the highest quality dentistry available and with the most compassionate, respectful care you deserve.

    Regards,
    Dentist In Chicopee


    ReplyDelete
  2. @admin

    We provide quality dental care, conveniently in your neighborhood, and cater to your schedule. Because your comfort is important to us, we offer many of the modern amenities you’ve come to expect in a dental office.

    Regards,
    Dentist In Northampton, MA

    ReplyDelete

  3. That's really an outstanding blog! I was in a fix, to begin with learning Java spring frameworkor not. But now my confusion is clear, and now I am also thinking of working with more freelance projects through Eiliana.com. Since I am already working on other tech projects through this platform and I find it quite reliable, I am thinking of continuing working with this one.

    ReplyDelete
  4. Following the discontinuation of the Indian Premier League in 2021, there have been questions regarding how world777 fantasy gaming sites can cope without it.

    ReplyDelete

  5. Dental Magik provides a wide variety of dental services and procedures to address all of our patient’s dental health needs. By combining quality patient care with up-to-date technology, we are able to treat patients of all ages in a comfortable and relaxing setting. Our website includes information on the following Dental Services: Cosmetic Dentist, Family Dentist, General Dentist, Emergency Dentist, Dental Implants, Teeth Whitening, Dental Veneers, Dentures, Dental Crowns and more.
    Dentist near me

    ReplyDelete

  6. Get Quality Dental Care In Farmington, MA
    Farmington Dental is a highly well-respected dental clinic situated in Chicopee.
    It is where you can receive essential treatment and therapeutic dental health.
    You may also receive dental implants or perform any cosmetic dental procedure to improve your smile’s appearance.
    We provide emergency treatment and patient education to ensure you are familiar with your dentist and the services we are providing.
    EMERGENCY DENTIST IN FARMINGTON ,CT

    ReplyDelete

Post a Comment

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -