|
Re: Use cases for Generics
|
Posted: Nov 1, 2005 3:59 PM
|
|
Absence of <? T> thing is indeed unnecessary limitation. There is no way to create local variable of cyclically defined type, there is one only for parameter of method and classes. Say, given definitions of my example, I can create generic method with definition
public static <V extends Vertex<V,G>, G extends Graph<V,G>> List<V> searchOrder(Graph<V,G> graph){...}
but I can't create variable of that type G outside that method, so I'm bound to using lower type (FlowGraph) after creating object. But it's impossible if I don't want to public lower type FlowVertex, as just Vertex won't do, it should be Vertex parameterized by FlowGraph parameterazed by Vertex, parameterized by FlowGraph, ... And I definately don't want to write all not-that-generic code concerning only concrete FlowGraph in parameterized functions.
|
|