Why getWindowHandles() method returns set?

19 views
Skip to first unread message

Mayur Shah

unread,
Dec 5, 2016, 10:08:09 PM12/5/16
to Selenium Users

In Selenium getWindowHandles() method returns Set, what is the reason? Why can't it return List?

⇜Krishnan Mahadevan⇝

unread,
Dec 5, 2016, 10:40:28 PM12/5/16
to Selenium Users
List can have duplicates but Set cannot have duplicates. 
On a similar note, window handles are expected to be unique in nature (else your switch to window logic goes for a toss) and Set guarantees uniqueness.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Tue, Dec 6, 2016 at 5:06 AM, Mayur Shah <ma...@mayurshah.in> wrote:

In Selenium getWindowHandles() method returns Set, what is the reason? Why can't it return List?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3f8a77f8-03fd-4c8b-ab1d-8aecd8da7c79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages