Comparing 2 dimensional Array to 1 dimensional Array in java -


There are elements array of array 1, so there are four element-arrays in array 1.

The second array is a one dimensional array.

My job is that every string of an element-array exists in array 2 or not. If present, the value should be printed.

  string [] [] arr1 = {{"a", "b", "c", "d"}, {"a", "d", "f"} {"d", "a", "b"}, {"a", "b", "c", "d"}}; String [] arr2 = {"a", "b", "d", "f"};   

should be output:

  adfdab   

how can I process these arrays for the required output ?

  {"A", "D", "F"}, {"D", "A", "B"}, {"A", "A", "C", "D"}, {"A" , "B", "c", "d"}}; String [] arr2 = {"a", "b", "d", "f"}; (String [] letters: arr1) {boolean contains all = true; For (string letters: letters) {boolean match = wrong; (For string: arr2) {if (letter.equals (s)) match = true; } If (! Match) {contains all = false; break; }} If (included in all) {System.out.println (Arrays.toString (letters)); }}   

is out:

  [a, d, f] [d, a, b]    

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 -