public static <GItem> Comparator<GItem> chainedComparator(final Comparator<? super GItem> comparator1, final Comparator<? super GItem> comparator2)
		throws NullPointerException {
		if (comparator1 == null) throw new NullPointerException("comparator1 = null");
		if (comparator2 == null) throw new NullPointerException("comparator2 = null");
		return new Comparator<GItem>() {

			@Override
			public int compare(final GItem item1, final GItem item2) {
				final int result = comparator1.compare(item1, item2);
				if (result != 0) return result;
				return comparator2.compare(item1, item2);
			}

			@Override
			public String toString() {
				return Objects.toInvokeString("chainedComparator", comparator1, comparator2);
			}

		};
	}