Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I read the other post and added <a href="https://stackoverflow.com/a/8637983/1068746">a running code of my own</a>. perhaps you should look there. It generates the Triangles and everything. Anyway, this is not a "naming convention" question and would probably get the right feedback if you changed the question to "how to make an instance in java". </p> <p>The complete code I wrote there (if you don't feel like clicking links) is here as well and should fill in any blanks other people left for you to fill in : </p> <pre><code>import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class Triangle { private int[]sides; public Triangle( int x, int y, int z) { sides = new int[]{x,y,z}; Arrays.sort( sides ); } public Triangle( String ... args ) { this( Integer.parseInt( args[0].trim() ), Integer.parseInt( args[1].trim() ), Integer.parseInt( args[2].trim() )); } @Override public boolean equals( Object o ) { if ( this == o ) return true; if ( o == null || getClass() != o.getClass() ) return false; Triangle triangle = ( Triangle ) o; if ( !Arrays.equals( sides, triangle.sides ) ) return false; return true; } @Override public int hashCode() { return sides != null ? Arrays.hashCode( sides ) : 0; } @Override public String toString() { return "Triangle{" + "sides=" + Arrays.toString( sides ) + '}'; } public static void main( String[] args ) throws IOException { String[] input = new String[]{ "1,2,1" , "1,1,2", "1,2,3","1,3,1","1,1,1","1,3,3","1,1,3"}; Set&lt;Triangle&gt; triangles = new HashSet&lt;Triangle&gt;( ); for ( String s : input ) { triangles.add( new Triangle( s.split( "," ) ) ); } System.out.println( "triangles = " + triangles ); } } </code></pre>
    singulars
    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. 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