java - ArrayDeque class of chars -
I am trying to transfer a Carence Balancer written in C ++ in Java.
I am trying to implement the stack with an ArrayDek class from the deck interface so that there is an ardade of characters like this:
And the compiler sticks to the claim on this - What I'm remembering Am I You can not use primitive types as normal parameters, you need related object rappers: Update our box class to use generic. We changed the code from li> deck < Char & gt; Parens = new ArrayDeque & lt; Char & gt; ();
Expected: Reference / Found: char
deck & lt; Character & gt; Legs = new ArrayDek & lt; Character & gt; ();
public square box to
public square box & lt; T & gt; by declaring a normal type of announcement; It presents a type of variable, which is named
T , which can be used anywhere in the classroom. It can also be applied for the same technology interface. There is nothing particularly complex about this concept, in fact, it is generally similar to the variables you already know about. Just think of
T as a special type of variable whose "value" will be of any type you have passed; It can be a class type, an interface type, or another type of variable. This can not be just one of the primitive data types. In this context, we also say that the
T box is the formal type parameter of the category.
Comments
Post a Comment