[
https://issues.apache.org/jira/browse/COLLECTIONS-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12978485#action_12978485
]
Michael Yannakopoulos commented on COLLECTIONS-323:
---------------------------------------------------
A quick question: IllegalArgumentException as far as the capacity of the hash
map is concerned should be changed or the load factor should be treated the
same since it throws the same exception? What i mean is if we are only
interested in capacity or if the load factor should throw the same exception if
is a negative number?
> Behavior of constructors CaseInsensitiveMap inconsistent with standard Java
> HashMap
> -----------------------------------------------------------------------------------
>
> Key: COLLECTIONS-323
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-323
> Project: Commons Collections
> Issue Type: Bug
> Components: Map
> Affects Versions: 3.2
> Environment: Any
> Reporter: Maarten Brak
> Priority: Minor
> Fix For: 4.x
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The constructor CaseInsensitiveMap(int initialCapacity) throws an
> IllegalArgumentException if "the initial capacity is less than one". This is
> inconsistent with the standard Java HashMap constructor HashMap(int
> initialCapacity), which throws an if IllegalArgumentException if "the initial
> capacity is negative".
> Thus:
> new HashMap(0) ==> no exception
> new CaseInsensitiveMap(0) ==> IllegalArgumentException.
> This inconsistency is confusing.
> Actions:
> - Change Javadoc (this shouldn't be a problem in practice since surely there
> is no code around depending on the fact that the constructor throws an
> IllegalArgumentException :-))
> - Change code.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.