@Override
 public AtomicElement getAtomicElement(NSIndexPath indexPath) {
   return PeriodicElements.getSharedPeriodicElements()
       .getElementsWithInitialLetter(
           PeriodicElements.getSharedPeriodicElements()
               .getElementNameIndexes()
               .get(indexPath.getSection()))
       .get(indexPath.getRow());
 }
  @Override
  public long getNumberOfRowsInSection(UITableView tableView, long section) {
    // the section represents the initial letter of the element
    // return that letter
    String initialLetter =
        PeriodicElements.getSharedPeriodicElements().getElementNameIndexes().get((int) section);

    // get the array of elements that begin with that letter
    List<AtomicElement> elementsWithInitialLetter =
        PeriodicElements.getSharedPeriodicElements().getElementsWithInitialLetter(initialLetter);
    // return the count
    return elementsWithInitialLetter.size();
  }
 @Override
 public List<String> getSectionIndexTitles(UITableView tableView) {
   // returns the array of section titles. There is one entry for each
   // unique character that an element begins with
   // [A,B,C,D,E,F,G,H,I,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z]
   return PeriodicElements.getSharedPeriodicElements().getElementNameIndexes();
 }
 @Override
 public long getNumberOfSections(UITableView tableView) {
   // this table has multiple sections. One for each unique character that
   // an element begins with
   // [A,B,C,D,E,F,G,H,I,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z]
   // return the size of that array
   return PeriodicElements.getSharedPeriodicElements().getElementNameIndexes().size();
 }
 @Override
 public String getTitleForHeader(UITableView tableView, long section) {
   // this table has multiple sections. One for each unique character that
   // an element begins with
   // [A,B,C,D,E,F,G,H,I,K,L,M,N,O,P,R,S,T,U,V,X,Y,Z]
   // return the letter that represents the requested section
   // this is actually a delegate method, but we forward the request to the
   // datasource in the view controller
   return PeriodicElements.getSharedPeriodicElements().getElementNameIndexes().get((int) section);
 }
 @Override
 public long getNumberOfRowsInSection(UITableView tableView, long section) {
   return PeriodicElements.getSharedPeriodicElements().getElementsSortedByNumber().size();
 }
 @Override
 public AtomicElement getAtomicElement(NSIndexPath indexPath) {
   return PeriodicElements.getSharedPeriodicElements()
       .getElementsSortedByNumber()
       .get(indexPath.getRow());
 }