From: Eric Sosman on
On 7/8/2010 5:35 PM, Boris Punk wrote:
> Integer.MAX_VALUE = 2147483647
>
> I might need more items than that. I probably won't, but it's nice to have
> extensibility.

Then Java is not the language for you. Arrays have int sizes.
Not even Collections can get you out of the woods, because their
..size() method must return an int.

I suppose you could write your own BigList class, with a .size()
method returning long and with .get() and .set() taking long arguments.
Such a class could not implement the List interface (because the method
signatures wouldn't be right), but you could probably implement
Iterable.

Or, you could have BigList implement List but "lie" in its .size()
method, in somewhat the same way TreeSet "lies" about the Set contract.
Then you'd add .realSize(), .realGet(), and .realSet() methods to deal
with the long values (I've probably missed a few).

... but I think you'll need a stronger motivation than "it's nice"
to justify the work, and the resulting ugliness. Your call, though.

--
Eric Sosman
esosman(a)ieee-dot-org.invalid
From: Boris Punk on

"Eric Sosman" <esosman(a)ieee-dot-org.invalid> wrote in message
news:i15imo$88e$1(a)news.eternal-september.org...
> On 7/8/2010 5:35 PM, Boris Punk wrote:
>> Integer.MAX_VALUE = 2147483647
>>
>> I might need more items than that. I probably won't, but it's nice to
>> have
>> extensibility.
>
> Then Java is not the language for you. Arrays have int sizes.
> Not even Collections can get you out of the woods, because their
> .size() method must return an int.
>
> I suppose you could write your own BigList class, with a .size()
> method returning long and with .get() and .set() taking long arguments.
> Such a class could not implement the List interface (because the method
> signatures wouldn't be right), but you could probably implement
> Iterable.
>
> Or, you could have BigList implement List but "lie" in its .size()
> method, in somewhat the same way TreeSet "lies" about the Set contract.
> Then you'd add .realSize(), .realGet(), and .realSet() methods to deal
> with the long values (I've probably missed a few).
>
> ... but I think you'll need a stronger motivation than "it's nice"
> to justify the work, and the resulting ugliness. Your call, though.
>
> --
> Eric Sosman
> esosman(a)ieee-dot-org.invalid

Is there no BigList/BigHash in Java?


From: Arne Vajhøj on
On 08-07-2010 18:22, Boris Punk wrote:
> Is there no BigList/BigHash in Java?

No.

But You can have a List<List<X>> which can then
store 4*10^18 X'es.

Arne

From: Arne Vajhøj on
On 08-07-2010 17:35, Boris Punk wrote:
> Integer.MAX_VALUE = 2147483647
>
> I might need more items than that. I probably won't, but it's nice to have
> extensibility.

It is a lot of data.

I think you should assume YAGNI.

Arne

From: Arne Vajhøj on
On 08-07-2010 17:15, Lew wrote:
> From the JLS, which I strongly urge you to study:

Unless the poster has a solid programming experience,
then the JLS may not be the best to study.

Sure it is by definition correct, but it is written
to be detailed and correct not to be easy to read.

Arne