Groovy has tapand with functions. What is the difference between them
def user = new User('john', 1)
.tap {userService.save(it)}
def user2 = new User('Alex', 2)
.with {userService.save(it)}
userService updates the record and returns updated record.
class UserService {
public User save(final User user) {
// save user
return updated // Id, lastmodified and other fields can be updated.
}
}