[Bug] Rule Sheet Violation #8

Closed
opened 2020-12-26 02:41:00 +01:00 by Speiger · 0 comments
Owner

The get & contains & remove method using Objects are right now converted to type-specific methods, now that is fine in most cases but there are cases where non-type-specific methods are really useful. Because Compare-Method is: Input.equals(collectionValue), that means the input decides if the key matches it should still work.
Adding an Object is a different story there the function should be converted to a type Specific method.

As an example: In a IntList a Integer should be able to remove an entry, but also a MutableInt from the Apache Library and a custom class that masks itself with a Integer. Since the Integer is final that is not possible with the type specific case.
I know of many cases where using that fact helped simplify a lot of code and it is intended by the Java Developers.

  • Methods to fix:
    • contains
    • containsAll
    • containsAny
    • indexOf
    • lastIndexOf
    • get
    • remove
    • removeAll
The get & contains & remove method using Objects are right now converted to type-specific methods, now that is fine in most cases but there are cases where non-type-specific methods are really useful. Because Compare-Method is: Input.equals(collectionValue), that means the input decides if the key matches it should still work. Adding an Object is a different story there the function should be converted to a type Specific method. As an example: In a IntList a Integer should be able to remove an entry, but also a MutableInt from the Apache Library and a custom class that masks itself with a Integer. Since the Integer is final that is not possible with the type specific case. I know of many cases where using that fact helped simplify a lot of code and it is intended by the Java Developers. - Methods to fix: - [X] contains - [X] containsAll - [X] containsAny - [X] indexOf - [X] lastIndexOf - [X] get - [X] remove - [X] removeAll
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Speiger/Primitive-Collections#8
No description provided.