Note that there are some explanatory texts on larger screens.

plurals
  1. POcompare two arrayList and stock the result in a thirth arrayList
    primarykey
    data
    text
    <p>i want compare 2 arrayList when i stock in them the result of a class java of telnet this class it's to telnet about a router and gives all of interfaces of this routers then stock them in the arrayList so i stock the interfaces for the router1 in myData1 and the second in myData2 and i will compare if the interface of the first aray it's the same in the second just add one of them in the array of result myData but it gives me anthing the code</p> <pre><code>public class Test { public static void main(String[] args) { Connection conn = null; try { conn = DriverManager.getConnection("jdbc:mysql://localhost/mohammedia", "root", "123456"); String sql = "SELECT * FROM router;"; Telnet_Interface telnet = new Telnet_Interface(); Telnet_Interface telnet1 = new Telnet_Interface(); Telnet_Interface telnet2 = new Telnet_Interface(); PreparedStatement prest = conn.prepareStatement(sql); ResultSet res=prest.executeQuery(); while(res.next()){ telnet1.Config(res.getString(1), "user", "passwd", res.getString(1)); telnet2.Config(res.getString(2), "user", "passwd", res.getString(2)); } ArrayList myData=new ArrayList(); ArrayList myData1=telnet1.getMyData(); ArrayList myData2=telnet2.getMyData(); boolean bool=false; for(int i=0;i&lt;myData1.size();i++) { for(int j=0;j&lt;myData2.size();j++) { if (myData2.get(j).equals(myData1.get(i))) { bool=true; //System.out.print("sdfsd"); } if(!bool) { myData.add(myData2.get(j)); //System.out.print("sdsd"); } } } for(int x=0;x&lt;myData.size();x++) { System.out.print(myData.get(x)); } } catch (SQLException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } } } </code></pre> <p>what's the problem ?? thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload