nlsr: refactor equality operator

Change-Id: Iaaef9511e6569d597afcc5fa083b98ce86d8f78d
refs: #4127
diff --git a/src/adjacency-list.cpp b/src/adjacency-list.cpp
index d5e6dfe..bd6783c 100644
--- a/src/adjacency-list.cpp
+++ b/src/adjacency-list.cpp
@@ -87,32 +87,14 @@
 bool
 AdjacencyList::operator==(const AdjacencyList& adl) const
 {
-  if (size() != adl.size()) {
+  if (m_adjList.size() != adl.getAdjList().size()) {
     return false;
   }
 
-  auto comparator =
-    [] (const Adjacent* lhs, const Adjacent* rhs) {
-      return *lhs < *rhs;
-  };
+  std::set<Adjacent> ourList(m_adjList.cbegin(), m_adjList.cend());
+  std::set<Adjacent> theirList(adl.getAdjList().cbegin(), adl.getAdjList().cend());
 
-  std::vector<const Adjacent*> ourList;
-  std::transform(m_adjList.begin(), m_adjList.end(),
-                 std::back_inserter(ourList), std::pointer_traits<const Adjacent*>::pointer_to);
-
-  std::vector<const Adjacent*> theirList;
-  std::transform(adl.getAdjList().begin(), adl.getAdjList().end(),
-                 std::back_inserter(theirList), std::pointer_traits<const Adjacent*>::pointer_to);
-
-  std::sort(ourList.begin(), ourList.end(), std::bind(comparator, _1, _2));
-  std::sort(theirList.begin(), theirList.end(), std::bind(comparator, _1, _2));
-
-  for (size_t i = 0; i < ourList.size(); i++) {
-    if (*(ourList[i]) != *(theirList[i])) {
-      return false;
-    }
-  }
-  return true;
+  return ourList == theirList;
 }
 
 int32_t