Monday, November 7, 2022

[FIXED] How to remove a string from a Set<String>?

Issue

I have a Set<String> that contains a bunch of Strings. How can I remove a certain String from a Set<String>?


Solution

Do something like this

if(set.contains("arpit")) {
    set.remove("arpit");
}


Answered By - Arpit Ratan
Answer Checked By - Marilyn (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.