Experienced ruby programmer starting with Java I'm a ruby programmer who's writing Java for university. I'd love to get some feedback on how my Java looks and how to improve it to conform with the norms.

import java.util.Set;
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;

public class Cell {
  private Set&lt;Integer&gt; possibles;
  private List&lt;CellGroup&gt; groups;

  public Cell() {
    this.possibles = new HashSet&lt;Integer&gt;(java.util.Arrays.asList(1,2,3,4,5,6,7,8,9));
    this.groups = new ArrayList&lt;CellGroup&gt;();
  }

  public void register_cell_group(CellGroup group) {
    this.groups.add(group);
  }

  public void set(Integer number) {
    // Make the only possibile the set number
    this.possibles = new HashSet&lt;Integer&gt;();
    this.possibles.add(number);

    this.inform_groups();
  }

  public void not(Integer number) {
    this.possibles.remove(number);

    if (this.possibles.size() == 1) {
      this.inform_groups();
    }
  }

  public boolean is_solved() {
    return this.possibles.size() == 1;
  }

  private void inform_groups() {
    for (int i = 0; i &lt; this.groups.size(); i++) {
      this.groups.get(i).cell_solved(this, this.possibles.toArray(new Integer[0])[0]);
    }
  }
}
Edit: As Landei suggested, use camelCase! Thanks Landei.


Your set function does not need to take an Integer. Idiomatic code would only use an int. Autoboxing means you can still add an int to this.possibles.
Why don't you use is_solved in not?
not is surprising, and I need to read the code to know what it does. I'd suggest naming it remove?
What about this.possibles.iterator().next() instead of the toArray trick?
Use a for each statement in inform_groups:

for(CellGroup g : this.groups) {
     g.cell_solved(this, this.possibles.iterator().next());
}