java - Cannot instantiate the type Pair although not abstract -
trying write iterator returns pair: part of pairiterator
public pair next() { this.counter ++; pair p = new pair(this.l.get(counter - 1), this.l.get(counter)); //error occurs here } public class pair<e> { private e e1; private e e2; public pair(e e1, e e2) { this.e1 = e1; this.e2 = e2; } public e first() { return this.e1; } public e second() { return this.e2; } }
getting
cannot instantiate type pair
... although pair not abstract class/interface. why happening?
check imports. (or ide) imported pair class.
Comments
Post a Comment