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:

deck < Char & gt; Parens = new ArrayDeque & lt; Char & gt; ();

And the compiler sticks to the claim on this - Expected: Reference / Found: char

What I'm remembering Am I

You can not use primitive types as normal parameters, you need related object rappers:

  deck & lt; Character & gt; Legs = new ArrayDek & lt; Character & gt; ();   

Update our box class to use generic. We changed the code from 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.

  • li>

  • Comments

    Popular posts from this blog

    mysql - BLOB/TEXT column 'value' used in key specification without a key length -

    c# - Using Vici cool Storage with monodroid -

    python - referencing a variable in another function? -