Skip to content

Commit

Permalink
Update rules/S6877/java/rule.adoc
Browse files Browse the repository at this point in the history
Co-authored-by: leonardo-pilastri-sonarsource <[email protected]>
  • Loading branch information
kaufco and leonardo-pilastri-sonarsource authored Jan 30, 2024
1 parent 14cd547 commit 34a79f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rules/S6877/java/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ On the other hand, `Collection.reverse(List)` creates a completely new list that
`SequencedCollection.reversed()` should be the preferred method for two reasons:

1. It returns a more lightweight object, as it does not need to recreate the underlying data structure as `Collection.reverse(List)` does. It merely provides a wrapper for element access and the iterator.
2. It abstracts from the fact that the instance to which the call is applied is a list. This results in more generic code that is easier to port, for instance, when you want to use another collection data structure.
2. It abstracts from the fact that the collection instance is a list. This results in more generic code that is easier to port, for instance, when you want to use another collection data structure.
== How to fix it

Expand Down

0 comments on commit 34a79f9

Please sign in to comment.