Here you can find the source of getQNameComparator()
public static Comparator<QName> getQNameComparator()
//package com.java2s; /******************************************************************************* * Copyright (c) 2013, 2014, 2015 QPark Consulting S.a r.l. This program and the * accompanying materials are made available under the terms of the Eclipse * Public License v1.0. The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html. ******************************************************************************/ import java.util.Comparator; import javax.xml.namespace.QName; public class Main { /**/*from w w w.j a v a 2 s . c om*/ * Get a new {@link Comparator} comparing {@link QName}s. * * @return the {@link Comparator}. */ public static Comparator<QName> getQNameComparator() { final Comparator<QName> comparator = (o1, o2) -> { if (o1 == o2) { return 0; } else if (o2 == null) { return -1; } else if (o1 == null) { return 1; } else { return o1.toString().compareTo(o2.toString()); } }; return comparator; } }