Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34602
| From | Daniel Pitts <usenet@coloraura.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: array of HashSet<> |
| Date | 2016-06-11 12:30 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <njhos3$em$1@dont-email.me> (permalink) |
| References | <tbq1dbl7do4o9bdqo98prrmhe8tm4g6710@4ax.com> <nbi91j$soc$1@dont-email.me> <6gnhlb1a7t9ohs5486l2sr2p9t9o0hj47h@4ax.com> <3d649230-b916-4b5f-abd6-4037d35d7022@googlegroups.com> |
On 6/10/16 12:25 PM, Lew wrote: > Roedy Green wrote: >> Daniel Pitts wrote: >>> Simplest work-around: Use a List<Set<>> instead. >> >> Is what you are doing there just buryng the dirty work under the >> covers? inside ArrayList? > > What do you mean by "just burying"? Is there something wrong with simplifying "dirty work"? > > And teasing out the objective part of your question from the purple prose, no, it isn't. Arrays in Java are not generic, and there is an explicit prohibition of making arrays out of non-reifiable types. These restrictions do not apply to generic collections, obviously. So no, it isn't "just" anything, let alone "burying" some sort of "dirty" work. It's allowing the compiler to check your type assertions at compile time. > To be fair, ArrayList<T> is implemented with a lot of "unsafe" type casting. The difference is that the ArrayList implementation is guaranteed to be type-safe if generics are used. So in a way it does the dirty work for you, but that isn't the same as burying it. Since someone else has done the dirty work, why not take advantage of that, and use the proven type-safe interface. Not to mention, it is often preferable to use less-primitive types that describe the entity you need. Arrays are more primitive than Collection implementations.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
array of HashSet<> Roedy Green <see_website@mindprod.com.invalid> - 2016-02-26 16:12 -0800
Re: array of HashSet<> Arne Vajhøj <arne@vajhoej.dk> - 2016-02-26 20:01 -0500
Re: array of HashSet<> Arne Vajhøj <arne@vajhoej.dk> - 2016-02-27 10:05 -0500
Re: array of HashSet<> Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2016-02-26 21:13 -0800
Re: array of HashSet<> Robert Klemme <shortcutter@googlemail.com> - 2016-02-27 11:41 +0100
Re: array of HashSet<> Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2016-02-27 11:54 -0800
Re: array of HashSet<> Lew <lewbloch@gmail.com> - 2016-02-27 15:16 -0800
Re: array of HashSet<> Lew <lewbloch@gmail.com> - 2016-02-27 15:18 -0800
Re: array of HashSet<> Roedy Green <see_website@mindprod.com.invalid> - 2016-02-27 23:44 -0800
Re: array of HashSet<> Lew <lewbloch@gmail.com> - 2016-02-28 01:52 -0800
Re: array of HashSet<> Arne Vajhøj <arne@vajhoej.dk> - 2016-02-28 08:38 -0500
Re: array of HashSet<> Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-02-28 08:56 -0500
Re: array of HashSet<> Arne Vajhøj <arne@vajhoej.dk> - 2016-02-28 12:47 -0500
Re: array of HashSet<> Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-02-28 13:27 -0500
Re: array of HashSet<> Sebastian <news@seyweiler.dyndns.org> - 2016-02-28 23:53 +0100
Re: array of HashSet<> Arne Vajhøj <arne@vajhoej.dk> - 2016-02-28 21:16 -0500
Re: array of HashSet<> Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2016-02-28 23:36 -0800
Re: array of HashSet<> Roedy Green <inquiry@mindprod.com> - 2016-06-08 20:08 -0700
Re: array of HashSet<> Andreas Leitgeb <avl@logic.at> - 2016-02-29 13:19 +0000
Re: array of HashSet<> Andreas Leitgeb <avl@logic.at> - 2016-02-29 13:27 +0000
Re: array of HashSet<> Daniel Pitts <usenet@coloraura.com> - 2016-03-06 13:59 -0800
Re: array of HashSet<> Roedy Green <inquiry@mindprod.com> - 2016-06-08 20:10 -0700
Re: array of HashSet<> Lew <lewbloch@gmail.com> - 2016-06-10 12:25 -0700
Re: array of HashSet<> Daniel Pitts <usenet@coloraura.com> - 2016-06-11 12:30 -0700
Re: array of HashSet<> Roedy Green <inquiry@mindprod.com> - 2016-06-12 02:31 -0700
csiph-web