XPathNodeSet constructor

XPathNodeSet(
  1. Iterable<XmlNode> nodes, {
  2. bool isSorted = false,
  3. bool isUnique = false,
})

Constructs a new node-set from nodes. By default we assume that the input require sorting (isSorted = false) and deduplication (isUnique = false).

Implementation

factory XPathNodeSet(Iterable<XmlNode> nodes,
    {bool isSorted = false, bool isUnique = false}) {
  if (!isUnique) nodes = nodes.toSet();
  final list = nodes.toList(growable: false);
  if (!isSorted || !isUnique) {
    list.sort((a, b) => a.compareNodePosition(b));
  }
  return XPathNodeSet._(list);
}