java - Unable to access my boolean list -


So I have this list & lt; & Gt; Includes Boolean Areas: Stable list & lt; Boolean [] & gt; myList = new arreelist & lt; & Gt; ();

And I add to this list:

  Boolean [mybooleanArray = new boolean [8];   

So now when I take my list with () loop, using it:

myList.get (i);

There is something like this in my output console:

  [z @ 65e7c41f   

but I want to do a lot in Theoj objects too I am How can I do this?

As the organs do not override the methods from the object class, you get the default string representation That is:

  getClass () GetName () + '@' + integer.tocestring (hash code ())   

If you want to print the content of an array, you can use it. {boolean [arr: myList] {System.out.println (Arrays.toString (arr)) for

 ; }   


I do not know what you are doing with your boolean array with your list , but know that your Small surprises can be passed:
  public class test (static list & lt; Boolean [] & gt; myList = new arreelist & lt; & Gt; (); Public static zero main (string [] args) {boolean [arr = arr = {true, wrong}; Boolean [] arr2 = {true, wrong}; MyList.add (Arrival); Println (myList.contains (arr2)); // false}}   

Alternatively, to create a wrapper class that wraps your boolean array and you can use the methods, and correctly equal < / Code>, toString and hashode methods.

  class MyBooleanArray {Private Boolean [arr] arr; Public namesphere (boolean [] arr) {this.arr = arr; } @ Override Public Ent Hashod () {Final At Prime = 31; Full result = 1; Results = Prime * Result + Arrays.hashCode (arr); Return result; } @ Override Public Boolean Equals (Object OBJE) {If (this == obje) returns is true; If (obj == faucet) return false; If (getClass ()! = Obj.getClass ()) false return; Mayurbiarere Other = (Maybolière) Ob; If (Arrays.equals (arr, other.arr)) false return; Back true; } @ Override public string toasting () {"mybollier [arr =" + Arrays.toString (arr) + "]" "return"; }}   

and main:

  public class exam (static list & lt; MyBooleanArray & gt; myList = new arreelist & lt; & Gt; (); Public Stable Zero Main (string [] Args) {Boolean [arr] arr = {true, wrong}; Boolean [] arr2 = {true, wrong}; myList.add (new MyBooleanArray (arr)); System.out.println (myList.contains (new MyBooleanArray (arr2)); // true system.out.println (myList.get (0)); // mybollier [arr = [true, false]]}}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -