Code Highlighting test


Table of Contents

Examples

Examples

public class ExposesDataStructure {
  private List theDataStructure;
  
  public getDataStructure() {
    return theDataStructure;
  }
}
public class DoesNotExposeDataStructure {
   // This is conceptually a data structure
   private ListWrapper theWrapper;
   
   public getWrapper() {
     return theWrapper;
   }
 }
 
public class Wrapper {
  private List theList;
   
  public addAMeaningfulEntity(MenaingfulEntity anEntity) {
    theList.add(anEntity);
  }
   
  public removeAMeaningfulEntity(MenaingfulEntity anEntity) throws EntityNotPresentException {
    if (!theList.contains(anEntity)) {
      throw new EntityNotPresentException (anEntity + “ is not present in structure”);
    }
    else {
      theList.add(anEntity);
    }
  }
}