If two values are sufficiently closely related to warrant being returned at the same time from a function, then those two values deserve to be encapsulated into a single object. From the example, I would assume that x and y are coordinates of a 2d point. You should be passing around Point2D objects in that case, not separate values.