title: JAVA - How to map efficiently a property from a list to an other?
body: <p>So i have those two object</p>
  <pre><code>public class Setting {
  
  @Id
  private Long fooId;
  
  @Transient
  private String fooLabel
  
  //GETTER and SETTER ommited
  }
  </code></pre>
  <p>and</p>
  <pre><code>public class Foo {
  
  @Id
  private Long id;
  
  @Column
  private String fooLabelEn
  
  @Column
  private String fooLabelFr
  
  public getLocalLabel(){}
  }
  </code></pre>
  <p>I can easily get the label i need, in english or in an other language, and i want to add it in my list of Setting. I can't modify the Foo table, and i can't save all label in Setting.</p>
  <p>I tried something like this, but it's not really efficent.</p>
  <pre><code>fooList = fooRepository.findAllById(settingIdList);
  settingList.stream()
      .map(setting -&gt; setting.setLabel(fooList.stream()
          .filter(foo -&gt; foo.getId().equals(setting.getFooId())
          .findFirst()
          .get()
          .getLocalLabel)
      )
      .collect(Collectors.toList());
  </code></pre>
  <p>I think i forgot something, and i feel i don't go in the right direction. I can only save ids for the settings, so i have to do something like this.</p>
  <p>Does anyone have a complient solution ?</p>
  <p>Thanks for the help.</p>