> I am aware that the correct syntax for creating new collection is as
> follows:
[quoted text clipped - 8 lines]
>
> Thanks much.
Just use
type a = list.get();
>I am aware that the correct syntax for creating new collection
>is as follows:
>ArrayList<type> list = new ArrayList<type>();
This is an expression statement. There is not a unique
"correct syntax for creating new collection [objects]", while
usually an invocation of a factory method or an instance
creation expression ist involved.
>Could someone show me the correct syntax (if any) if one gets
>the collection from a known casted object as below. ie., where
>should I put <type> on the right side?
>ArrayList<type> list = ((SomeClass)someClassObject).getSomeCollection();
There is no need to do so, though it might be possible in some
cases. This depends on how »getSomeCollection« is declared
(see its documentation). If it takes a type argument at all,
it would look like:
object.<type>method();
This does not necessarily have to be the same type as in
»ArraysList<type>«. And this is not »collection syntax«, but
method invocation syntax.