Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #33884 > unrolled thread

array of HashSet<>

Started byRoedy Green <see_website@mindprod.com.invalid>
First post2016-02-26 16:12 -0800
Last post2016-06-12 02:31 -0700
Articles 5 on this page of 25 — 11 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#33938

FromDaniel Pitts <usenet@coloraura.com>
Date2016-03-06 13:59 -0800
Message-ID<nbi91j$soc$1@dont-email.me>
In reply to#33884
On 2/26/16 4:12 PM, Roedy Green wrote:
> I take it is impossible to write a valid Java program containing an
> array of HashSet<> s.
>
> Any ideas for a work around?
>
Simplest work-around:  Use a List<Set<>> instead.

[toc] | [prev] | [next] | [standalone]


#34581

FromRoedy Green <inquiry@mindprod.com>
Date2016-06-08 20:10 -0700
Message-ID<6gnhlb1a7t9ohs5486l2sr2p9t9o0hj47h@4ax.com>
In reply to#33938
On Sun, 6 Mar 2016 13:59:07 -0800, Daniel Pitts <usenet@coloraura.com>
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?

[toc] | [prev] | [next] | [standalone]


#34595

FromLew <lewbloch@gmail.com>
Date2016-06-10 12:25 -0700
Message-ID<3d649230-b916-4b5f-abd6-4037d35d7022@googlegroups.com>
In reply to#34581
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.

-- 
Lew


[toc] | [prev] | [next] | [standalone]


#34602

FromDaniel Pitts <usenet@coloraura.com>
Date2016-06-11 12:30 -0700
Message-ID<njhos3$em$1@dont-email.me>
In reply to#34595
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.

[toc] | [prev] | [next] | [standalone]


#34609

FromRoedy Green <inquiry@mindprod.com>
Date2016-06-12 02:31 -0700
Message-ID<rraqlbhnh1olnd8q2ioimal0t9pfpe7l3u@4ax.com>
In reply to#34595
On Fri, 10 Jun 2016 12:25:37 -0700 (PDT), Lew <lewbloch@gmail.com>
wrote:

>What do you mean by "just burying"? Is there something wrong with simplifying "dirty work"?

The problem cannot be solved without error/warning messages.  All can
do is cheat inside ArrayList and not compile it yourself, so you don't
notice the flaw.

There is something ugly that library code cannot be compiled cleanly.
It is not somthing Wirth or Meyer would do.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.java.programmer


csiph-web