Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[javase] Collection #13

Open
Alice52 opened this issue Jun 10, 2019 · 1 comment
Open

[javase] Collection #13

Alice52 opened this issue Jun 10, 2019 · 1 comment
Assignees
Labels
Java java implement important than extend TODO Tool language: tool issue

Comments

@Alice52
Copy link
Owner

Alice52 commented Jun 10, 2019

Collection

Array

Set

List

  1. LinkedList and ArrayList:

    • using ArrayList to query
    • using ArrayList to insert in middle
    • using ArrayList to insert tail element is perfomance better
    • using LinkedList to insert into top

    List

@Alice52 Alice52 self-assigned this Jun 10, 2019
@Alice52 Alice52 changed the title Cllection Collection Jun 10, 2019
@Alice52 Alice52 closed this as completed Jun 13, 2019
@Alice52 Alice52 added the Java java implement important than extend label Dec 2, 2019
@Alice52 Alice52 changed the title Collection [javase] Collection Dec 2, 2019
@Alice52 Alice52 added the Completed Finishnew issue or request label Dec 5, 2019
@Alice52 Alice52 added TODO Tool language: tool issue labels Dec 23, 2019
@Alice52 Alice52 reopened this Dec 23, 2019
@Alice52 Alice52 removed the Completed Finishnew issue or request label Dec 23, 2019
@Alice52
Copy link
Owner Author

Alice52 commented Jul 15, 2021

List 去重: deduplicate

  1. LinkedHashSet
    LinkedHashSet<Integer> hashSet = new LinkedHashSet<>(numbersList);
    ArrayList<Integer> listWithoutDuplicates = new ArrayList<>(hashSet);
  2. stream: distinct
  3. 遍历自己写
  4. HashSet: 不稳定

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java java implement important than extend TODO Tool language: tool issue
Projects
None yet
Development

No branches or pull requests

1 participant