Re: Any Checkstyle users?
- From: "Daniel Dyer" <dan@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 14:22:26 -0000
On Tue, 31 Jan 2006 14:03:54 -0000, <slippymississippi@xxxxxxxxx> wrote:
BTW, it appears (from more recent posts in the thread) that the issue wasn't
the use of a magic number at all, but of a variable of type HashMap.
Not just HashMap:
"java.util.GregorianCalendar, java.util.Hashtable, java.util.HashSet, java.util.HashMap, java.util.ArrayList, java.util.LinkedList, java.util.LinkedHashMap, java.util.LinkedHashSet, java.util.TreeSet, java.util.TreeMap, java.util.Vector"
I suppose the check is pushing me to pass/return custom data objects that implement Java-specific data structures behind the scenes? I can't see how you would write meaningful code without eventually using one of the listed data structures, but I can see vaguely how it would be beneficial to wrapper the implementation of these data structures.
It seems to be advocating that you return java.util.Calendar, java.util.Map, java.util.Set, java.util.List, etc. In other words, return the interface type rather than the concrete implementation. No need to write any wrappers.
Dan.
-- Daniel Dyer http://www.dandyer.co.uk .
- References:
- Any Checkstyle users?
- From: slippymississippi
- Re: Any Checkstyle users?
- From: mikm
- Re: Any Checkstyle users?
- From: mikm
- Re: Any Checkstyle users?
- From: Chris Uppal
- Re: Any Checkstyle users?
- From: Rick Giles
- Re: Any Checkstyle users?
- From: Chris Uppal
- Re: Any Checkstyle users?
- From: slippymississippi
- Any Checkstyle users?
- Prev by Date: Re: What IDE for Java do you use?
- Next by Date: Re: Java 1.6 Heisenbug involving startsWith
- Previous by thread: Re: Any Checkstyle users?
- Next by thread: Re: Any Checkstyle users?
- Index(es):