title: Should a variable be made for method which is called multiple times?
body: <p>Here is my method:</p>
  
  <pre><code>public void addEmployee(Employee employee) {
  if(! employees.containsKey(employee.getName())) {
        employees.put(employee.getName(), employee);
    }
  }
  </code></pre>
  
  <p>As you see, there is an accessor <code>employee.getName()</code> which is called more than once. Should a programmer make a separate variable for such multiple calls? Like this:</p>
  
  <pre><code>public void addEmployee(Employee employee) {
  String name=employee.getName();
  if(! employees.containsKey(name)) {
     employees.put(name,employee);
    }
  }
  </code></pre>
  
  <p>Does it make sence from the performance point of view, not only style?</p>