Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try this, it finds duplicate values in all rows, and each row too, works for me :)</p> <pre><code>/* import java.util.ArrayList; import java.util.Collections; import java.util.List; public class DupRemove { public static void main(String...arg){ double val[]={1,4.3,5,2,4,4,4,6.5,2,2,2,2,2,3.5,3.7,4,7,8,9}; for(int i=0;i&lt;val.length;i++){ add(val[i]); } Collections.sort(list); System.out.println(list); } static List&lt;Double&gt; list=new ArrayList&lt;&gt;(); public static void add(double d){ if(!list.contains(d)){list.add(d);} } } */ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class PointStatue { /*private static List&lt;Double&gt; col1 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col2 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col3 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col4 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col5 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col6 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col7 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col8 = new ArrayList&lt;Double&gt;();*/ //private static List&lt;Double&gt; list=new ArrayList&lt;Double&gt;(); private static ArrayList&lt;List&lt;Double&gt;&gt; rows=new ArrayList&lt;List&lt;Double&gt;&gt;(); private static List&lt;Double&gt; numbers = new ArrayList&lt;Double&gt;(); private static void okuDiziyeKoy(String path,ArrayList&lt;String&gt; arr) throws Exception{ BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(path))); //skip the first line br.readLine(); String g; while((g=br.readLine())!=null){ arr.add(g); } } public static void main(String[] args) throws Exception { ArrayList&lt;String&gt; puan = new ArrayList&lt;String&gt;(); okuDiziyeKoy("C:/deneme/HW.txt", puan); // puan = okuDiziyeKoy("C:\\deneme\\HW.txt"); System.out.format("%d kayıt okundu.%n", puan.size()); Double doubleValue; for (int j = 0; j &lt; puan.size(); j++) { List&lt;Double&gt; listToAdd=new ArrayList&lt;Double&gt;(); rows.add(j, listToAdd); String point = puan.get(j); //split data(line) by }{ String[] edit = point.split("[}][{]"); for(int l=3;l&lt;edit.length-1;l++){ //parsing String as double doubleValue=Double.parseDouble(edit[l]); //check if double value is not exist then add it to list if(!numbers.contains(doubleValue)){ numbers.add(doubleValue); } if(!listToAdd.contains(doubleValue)){ listToAdd.add(doubleValue); } } /* for (String s : edit) { String a = s.replaceAll("[\\}\\-\\&gt;\\&gt;\\]\\[\\#\\*\\{]+", ""); String b = a.replaceAll("[\\.]+", ","); Scanner scanner = new Scanner(b); while (scanner.hasNext()) { if (scanner.hasNextDouble()) { doubleValue = scanner.nextDouble(); if(!numbers.contains(doubleValue)){ numbers.add(doubleValue); } // System.out.println(Arrays.deepToString(numbers.toArray())); }// if scan end else { //if it is string comes value here String stringValue = scanner.next(); }// if scan end }// while end }// for string s }// for j end*/ } Collections.sort(numbers); System.out.println("Unique values(in all rows): "); for(Double d :numbers){ System.out.print(d+" "); } System.out.println(); /*int col=1; for(int i=0;i&lt;numbers.size();i++) { Double rowValue = numbers.get(i); switch(col) { case 1: col1.add(rowValue); col++; break; case 2: col2.add(rowValue); col++; break; case 3: col3.add(rowValue); col++; break; case 4: col4.add(rowValue); col++; break; case 5: col5.add(rowValue); col++; break; case 6: col6.add(rowValue); col = 1; break; }//switch end }//for i end*/ /* Collections.sort(col1); Collections.sort(col2); Collections.sort(col3); Collections.sort(col4); Collections.sort(col5); Collections.sort(col6);*/ /*System.out.println("kolon1 "+col1); System.out.println("kolon2 "+col2); System.out.println("kolon3 "+col3); System.out.println("kolon4 "+col4); System.out.println("kolon5 "+col5); System.out.println("kolon6 "+col6);*/ //sorting each row for(int i=0;i&lt;rows.size();i++){ Collections.sort(rows.get(i)); } //showing each row(array) for(int i=0;i&lt;rows.size();i++){ System.out.println("kolon"+i+": "+rows.get(i)); } }// main end } </code></pre> <p>dup in columns:</p> <pre><code>/* import java.util.ArrayList; import java.util.Collections; import java.util.List; public class DupRemove { public static void main(String...arg){ double val[]={1,4.3,5,2,4,4,4,6.5,2,2,2,2,2,3.5,3.7,4,7,8,9}; for(int i=0;i&lt;val.length;i++){ add(val[i]); } Collections.sort(list); System.out.println(list); } static List&lt;Double&gt; list=new ArrayList&lt;&gt;(); public static void add(double d){ if(!list.contains(d)){list.add(d);} } } */ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class PointStatue { /*private static List&lt;Double&gt; col1 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col2 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col3 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col4 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col5 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col6 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col7 = new ArrayList&lt;Double&gt;(); private static List&lt;Double&gt; col8 = new ArrayList&lt;Double&gt;();*/ //private static List&lt;Double&gt; list=new ArrayList&lt;Double&gt;(); private static ArrayList&lt;List&lt;Double&gt;&gt; rows=new ArrayList&lt;List&lt;Double&gt;&gt;(); private static List&lt;Double&gt; numbers = new ArrayList&lt;Double&gt;(); private static void okuDiziyeKoy(String path,ArrayList&lt;String&gt; arr) throws Exception{ BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(path))); //skip the first line br.readLine(); String g; while((g=br.readLine())!=null){ arr.add(g); } } public static void main(String[] args) throws Exception { ArrayList&lt;String&gt; puan = new ArrayList&lt;String&gt;(); okuDiziyeKoy("C:/deneme/HW.txt", puan); // puan = okuDiziyeKoy("C:\\deneme\\HW.txt"); System.out.format("%d kayıt okundu.%n", puan.size()); Double doubleValue; for (int j = 0; j &lt; 6; j++) { rows.add(new ArrayList&lt;Double&gt;()); } for (int j = 0; j &lt; puan.size(); j++) { String point = puan.get(j); //split data(line) by }{ String[] edit = point.split("[}][{]"); for(int l=3;l&lt;edit.length-1;l++){ //parsing String as double doubleValue=Double.parseDouble(edit[l]); //check if double value is not exist then add it to list if(!numbers.contains(doubleValue)){ numbers.add(doubleValue); } if(!rows.get(l-3).contains(doubleValue)){ rows.get(l-3).add(doubleValue); } } /* for (String s : edit) { String a = s.replaceAll("[\\}\\-\\&gt;\\&gt;\\]\\[\\#\\*\\{]+", ""); String b = a.replaceAll("[\\.]+", ","); Scanner scanner = new Scanner(b); while (scanner.hasNext()) { if (scanner.hasNextDouble()) { doubleValue = scanner.nextDouble(); if(!numbers.contains(doubleValue)){ numbers.add(doubleValue); } // System.out.println(Arrays.deepToString(numbers.toArray())); }// if scan end else { //if it is string comes value here String stringValue = scanner.next(); }// if scan end }// while end }// for string s }// for j end*/ } Collections.sort(numbers); System.out.println("Unique values(in all rows): "); for(Double d :numbers){ System.out.print(d+" "); } System.out.println(); /*int col=1; for(int i=0;i&lt;numbers.size();i++) { Double rowValue = numbers.get(i); switch(col) { case 1: col1.add(rowValue); col++; break; case 2: col2.add(rowValue); col++; break; case 3: col3.add(rowValue); col++; break; case 4: col4.add(rowValue); col++; break; case 5: col5.add(rowValue); col++; break; case 6: col6.add(rowValue); col = 1; break; }//switch end }//for i end*/ /* Collections.sort(col1); Collections.sort(col2); Collections.sort(col3); Collections.sort(col4); Collections.sort(col5); Collections.sort(col6);*/ /*System.out.println("kolon1 "+col1); System.out.println("kolon2 "+col2); System.out.println("kolon3 "+col3); System.out.println("kolon4 "+col4); System.out.println("kolon5 "+col5); System.out.println("kolon6 "+col6);*/ //sorting each row for(int i=0;i&lt;rows.size();i++){ Collections.sort(rows.get(i)); } //showing each row(array) for(int i=0;i&lt;rows.size();i++){ System.out.println("kolon"+(i+1)+": "+rows.get(i)); } }// main end } </code></pre>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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