I have a constructor that gets HashSet and HashMap. I need to run a validation check on one hashMAp and combine it with a hashSet, since "super" should only get one hashSet. I cannot find a way to do this, as I get the following error: cannot reference this before supertype constructor
Example:
public class A extends B { public A(HashSet<Obj> h1, HashMap<UID,Objects> m1) { super(new C (h1) );
I want to do something like this:
public class A extends B { public A(HashSet<Obj> h1, HashMap<UID,Objects> m1) { runMyFunc(h1,m1); super(new C (h1) ); } runMyFunc(HashSet<Obj> h1, HashMap<UID,Objects> m1){
I thought the conversion of the constructor to private, and then run it like this:
public class A extends B { private A(HashSet<Obj> h1) { super(new C (h1) ); } public A(HashSet<Obj> h1, HashMap<UID,Objects> m1) { runMyFunc(h1,m1); this(h1); }
but it also did not work.
Can you consult?
source share