I knew that you could prevent code formatting in eclipse by surrounding the code with
// @formatter:off // my awesome formatted code... public Set<Person> transformCustomersToPersons(List<Customer> customers){ Set<Person> persons = new HashSet<Person>(); for (Customer customer : customers) { persons.add(new Person( customer.getFirstname(), customer.getLastname(), customer.getTitle(), customer.getBirthday(), customer.getAddress(0).getCity(), customer.getAddress(0).getStreet(), customer.getAddress(0).getHousenumber(), customer.isMan() ? "m" : "w", customer.getCardNumber()) ); } return persons; } // @formatter:on
But I do not want to write it manually all the time. It would be ideal to simply mark the code, press the hot key, and the code will be prevented by formatting.
Does anyone know how? thanks!
source share