Use Objects.hashCode()
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / util / ModuleDependencySort.java
index 05dbd2e1b7f1d7f0b4ba454e94138a257e59e396..837d71115f567c2ded7b4be8479ca0563f3ebadf 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -22,6 +23,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.Module;
@@ -41,7 +43,7 @@ import org.slf4j.LoggerFactory;
  */
 public final class ModuleDependencySort {
 
-    private static final Date DEFAULT_REVISION = new Date(0);
+    private static final Date DEFAULT_REVISION = SimpleDateFormatUtil.DEFAULT_DATE_REV;
     private static final Logger LOGGER = LoggerFactory.getLogger(ModuleDependencySort.class);
     private static final Function<Node, Module> TOPOLOGY_FUNCTION = new Function<TopologicalSort.Node, Module>() {
         @Override
@@ -79,6 +81,7 @@ public final class ModuleDependencySort {
     /**
      * Topological sort of module builder dependency graph.
      *
+     * @param builders builders of Module object
      * @return Sorted list of Module builders. Modules can be further processed
      *         in returned order.
      */
@@ -117,6 +120,7 @@ public final class ModuleDependencySort {
     /**
      * Topological sort of module dependency graph.
      *
+     * @param modules YANG modules
      * @return Sorted list of Modules. Modules can be further processed in
      *         returned order.
      */
@@ -332,8 +336,8 @@ public final class ModuleDependencySort {
         public int hashCode() {
             final int prime = 31;
             int result = 1;
-            result = prime * result + ((name == null) ? 0 : name.hashCode());
-            result = prime * result + ((revision == null) ? 0 : revision.hashCode());
+            result = prime * result + Objects.hashCode(name);
+            result = prime * result + Objects.hashCode(revision);
             return result;
         }