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

Replace Guava Lists.newArrayList(); with new ArrayList<>(); #270

Closed
vogella opened this issue Jun 7, 2022 · 1 comment · Fixed by #663
Closed

Replace Guava Lists.newArrayList(); with new ArrayList<>(); #270

vogella opened this issue Jun 7, 2022 · 1 comment · Fixed by #663
Milestone

Comments

@vogella
Copy link
Contributor

vogella commented Jun 7, 2022

AFAICS Guava Lists.newArrayList(); simply delegates to new ArrayList<>(); in WB therefore we can use this standard Java construct.

vogella added a commit to MarcelduPreez/windowbuilder that referenced this issue Jun 7, 2022
ComponentsPropertiesPage

First change for eclipse-windowbuilder#270 but usage of Lists.newArrayList() is still present
in lots of other files.
vogella added a commit to vogellacompany/windowbuilder that referenced this issue Jun 7, 2022
ComponentsPropertiesPage

First change for eclipse-windowbuilder#270 but usage of Lists.newArrayList() is still present
in lots of other files.
vogella added a commit that referenced this issue Jun 7, 2022
ComponentsPropertiesPage

First change for #270 but usage of Lists.newArrayList() is still present
in lots of other files.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 11, 2023


In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().

List.transform() or Iterables.filter() can be replaced by the Java
Stream API, which is also encouraged by their JavaDoc.

Occasionally, we use List.of() to create lists from arrays. But care has
to be taken here, because those lists are read-only. If values are
written to them afterwards, the constructed list is passted as an
argument to an ArrayList.

The MapMaker class which is used to create maps with weak keys/values
are replaced by the ReferenceMap.

The Multimap class is replaced by the MultiValueMap.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 11, 2023


In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().

List.transform() or Iterables.filter() can be replaced by the Java
Stream API, which is also encouraged by their JavaDoc.

Occasionally, we use List.of() to create lists from arrays. But care has
to be taken here, because those lists are read-only. If values are
written to them afterwards, the constructed list is passted as an
argument to an ArrayList.

The MapMaker class which is used to create maps with weak keys/values
are replaced by the ReferenceMap.

The Multimap class is replaced by the MultiValueMap.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 11, 2023
…wbuilder#270

In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().

Occasionally, we use Arrays.asList() to create lists from arrays. But
care has to be taken here, because those lists are read-only. If values
are written to them afterwards, the constructed list is passed as an
argument to an ArrayList.
Note that we use Arrays.asList() instead of List.of(), as latter doesn't
allow null elements.

The MapMaker class which is used to create maps with weak keys/values
are replaced by the ReferenceMap.

The Multimap class is replaced by the MultiValueMap.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 11, 2023
…wbuilder#270

In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().

Occasionally, we use Arrays.asList() to create lists from arrays. But
care has to be taken here, because those lists are read-only. If values
are written to them afterwards, the constructed list is passed as an
argument to an ArrayList.
Note that we use Arrays.asList() instead of List.of(), as latter doesn't
allow null elements.

The MapMaker class which is used to create maps with weak keys/values
are replaced by the ReferenceMap.

The Multimap class is replaced by the MultiValueMap.
ptziegler added a commit that referenced this issue Dec 12, 2023
In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().

Occasionally, we use Arrays.asList() to create lists from arrays. But
care has to be taken here, because those lists are read-only. If values
are written to them afterwards, the constructed list is passed as an
argument to an ArrayList.
Note that we use Arrays.asList() instead of List.of(), as latter doesn't
allow null elements.

The MapMaker class which is used to create maps with weak keys/values
are replaced by the ReferenceMap.

The Multimap class is replaced by the MultiValueMap.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 13, 2023
…wbuilder#270

In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().

We occasionally have to use Arrays.asList() or List.of(), depending on
whether we expect null values and whether the list should be modifiable.
ptziegler added a commit that referenced this issue Dec 13, 2023
In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().

We occasionally have to use Arrays.asList() or List.of(), depending on
whether we expect null values and whether the list should be modifiable.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 13, 2023
…uilder#270

In almost all cases, the call of Lists.newArrayList() can be simply
replaced with new ArrayList<>().
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 13, 2023
…uilder#270

Minor occurrences of collections and iterables which can be easilly
expressed using native Java methods.
ptziegler added a commit that referenced this issue Dec 14, 2023
Minor occurrences of collections and iterables which can be easilly
expressed using native Java methods.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 14, 2023
…lder#270

Use Lists utility class from AssertJ project as drop-in replacement.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 14, 2023
…lder#270

Use Lists utility class from AssertJ project as drop-in replacement.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 14, 2023
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 14, 2023
ptziegler added a commit that referenced this issue Dec 14, 2023
Use Lists utility class from AssertJ project as drop-in replacement.
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 14, 2023
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 14, 2023
ptziegler added a commit to ptziegler/windowbuilder that referenced this issue Dec 14, 2023
@ptziegler
Copy link
Contributor

With #663, the last remaining dependency to Guava has been removed. We now either use the corresponding Java methods directly or Commons Collections (for e.g. BidiMaps).

@ptziegler ptziegler added this to the 1.15.0 milestone Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants