Why doesn't java.util.Set have get(int index)?

前端 未结 18 1380
长情又很酷
长情又很酷 2020-11-28 18:14

I\'m sure there\'s a good reason, but could someone please explain why the java.util.Set interface lacks get(int Index), or any similar get()

18条回答
  •  余生分开走
    2020-11-28 18:33

    some data structures are missing from the standard java collections.

    Bag (like set but can contain elements multiple times)

    UniqueList (ordered list, can contain each element only once)

    seems you would need a uniquelist in this case

    if you need flexible data structures, you might be interested in Google Collections

提交回复
热议问题