Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.  @Override
  2.     public String getInfo() {
  3.  
  4.         StringBuilder sb = new StringBuilder();
  5.  
  6.         sb.append(this.name).append(String.format(" (%s):", this.getClass().getSimpleName())).append(System.lineSeparator());
  7.  
  8.  
  9.         String fishs  = "";
  10.  
  11.         for (Fish fis : this.fish) {
  12.             fishs+=fis.getName()+" ";
  13.         }
  14.  
  15.         fishs = fishs.trim();
  16.  
  17.         if (fishs.isEmpty()){
  18.             fishs = "none";
  19.         }
  20.  
  21.         sb.append(String.format("Fish: %s",fishs)).append(System.lineSeparator());
  22.         sb.append(String.format("Decorations: %d",this.decorations.size())).append(System.lineSeparator());
  23.  
  24.         int comfort = this.decorations.stream().mapToInt(Decoration::getComfort).sum();
  25.  
  26.         sb.append(String.format("Comfort: %d",comfort));
  27.  
  28.  
  29.         return sb.toString();
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement