Utility-like generic java code