src: improve constness

Change-Id: I8b3084e311642578628ea7c1017dc2a58979ab83
refs: #4472
diff --git a/src/adjacency-list.cpp b/src/adjacency-list.cpp
index c41917c..d5e6dfe 100644
--- a/src/adjacency-list.cpp
+++ b/src/adjacency-list.cpp
@@ -85,7 +85,7 @@
 }
 
 bool
-AdjacencyList::operator==(AdjacencyList& adl) const
+AdjacencyList::operator==(const AdjacencyList& adl) const
 {
   if (size() != adl.size()) {
     return false;
@@ -127,9 +127,9 @@
 }
 
 bool
-AdjacencyList::isNeighbor(const ndn::Name& adjName)
+AdjacencyList::isNeighbor(const ndn::Name& adjName) const
 {
-  std::list<Adjacent>::iterator it = find(adjName);
+  std::list<Adjacent>::const_iterator it = find(adjName);
   if (it == m_adjList.end())
   {
     return false;
@@ -158,9 +158,9 @@
 }
 
 int32_t
-AdjacencyList::getTimedOutInterestCount(const ndn::Name& neighbor)
+AdjacencyList::getTimedOutInterestCount(const ndn::Name& neighbor) const
 {
-  std::list<Adjacent>::iterator it = find(neighbor);
+  std::list<Adjacent>::const_iterator it = find(neighbor);
   if (it == m_adjList.end()) {
     return -1;
   }
@@ -168,9 +168,9 @@
 }
 
 Adjacent::Status
-AdjacencyList::getStatusOfNeighbor(const ndn::Name& neighbor)
+AdjacencyList::getStatusOfNeighbor(const ndn::Name& neighbor) const
 {
-  std::list<Adjacent>::iterator it = find(neighbor);
+  std::list<Adjacent>::const_iterator it = find(neighbor);
 
   if (it == m_adjList.end()) {
     return Adjacent::STATUS_UNKNOWN;
@@ -225,10 +225,10 @@
 }
 
 int32_t
-AdjacencyList::getNumOfActiveNeighbor()
+AdjacencyList::getNumOfActiveNeighbor() const
 {
   int32_t actNbrCount = 0;
-  for (std::list<Adjacent>::iterator it = m_adjList.begin(); it != m_adjList.end(); it++) {
+  for (std::list<Adjacent>::const_iterator it = m_adjList.begin(); it != m_adjList.end(); it++) {
 
     if (it->getStatus() == Adjacent::STATUS_ACTIVE) {
       actNbrCount++;
@@ -247,6 +247,17 @@
   return it;
 }
 
+std::list<Adjacent>::const_iterator
+AdjacencyList::find(const ndn::Name& adjName) const
+{
+  std::list<Adjacent>::const_iterator it = std::find_if(m_adjList.cbegin(),
+                                                        m_adjList.cend(),
+                                                        std::bind(&Adjacent::compare,
+                                                                  _1, std::cref(adjName)));
+  return it;
+}
+
+
 AdjacencyList::iterator
 AdjacencyList::findAdjacent(const ndn::Name& adjName)
 {