Make Array Unmodifiable?
From: Ken (kk_oop_at_yahoo.com)
Date: 05/31/04
- Next message: Joseph Jude: "Printer Control in Java"
- Previous message: Ken: "Type Safe Collections?"
- Next in thread: Pasi Havia: "Re: Make Array Unmodifiable?"
- Reply: Pasi Havia: "Re: Make Array Unmodifiable?"
- Reply: Rune Berge: "Re: Make Array Unmodifiable?"
- Reply: Ryan Stewart: "Re: Make Array Unmodifiable?"
- Reply: P.Hill: "Re: Make Array Unmodifiable?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 May 2004 05:50:40 -0700
Is there a standard approach or pattern for making an array that
cannot be modified? I ask this in this context: I'd like to be able
to return an array from a class method without letting the caller
subsequently modify the array. In C++ I'd return it as a const. Java
does not have such a construct. It seems that collections can handle
something like this, but then I lose the type safety of arrays.
Any suggestions?
Thanks,
Ken
- Next message: Joseph Jude: "Printer Control in Java"
- Previous message: Ken: "Type Safe Collections?"
- Next in thread: Pasi Havia: "Re: Make Array Unmodifiable?"
- Reply: Pasi Havia: "Re: Make Array Unmodifiable?"
- Reply: Rune Berge: "Re: Make Array Unmodifiable?"
- Reply: Ryan Stewart: "Re: Make Array Unmodifiable?"
- Reply: P.Hill: "Re: Make Array Unmodifiable?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|