How do I create a list in Java?

Asked 2 years ago, Updated 2 years ago, 84 views

Set is
Set myset = new HashSet()

You make it like this, right? How do I make a list?

list java collections

2022-09-22 11:38

1 Answers

List myList = new ArrayList();

List<MyType> myList = new ArrayList<MyType>();

Just give the example above and the general type below, and when you make a list, you can put the data type in the MyType part and write it down.


2022-09-22 11:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.