I was looking for solutions on how to get cookies by their name, and all solutions point to the use of for-loops and if . See code below.
for (Cookie cookie : cookies) { if (cookie.getName().equals("<NAME>")) { // do something here } if (cookie.getName().equals("<ANOTHER_NAME>")) { // do something here } // and so on... }
Is there any simpler way to get the value by their name without having to do loops, and what if?
I need to do some “specific” processing for certain cookies that I would like to receive Plus, I don’t want to go through every cookie! There may be 10 or more, and all I need is just three or something like that.
source share