Changeset 15017 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Extensions
- Timestamp:
- 06/01/17 09:28:34 (8 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Extensions
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Extensions/CollectionExtensions.cs
r14834 r15017 12 12 return source[x]; 13 13 } 14 15 public static int HashCode<T>(this IReadOnlyList<T> source) { 16 var hash = 19 * 31 + typeof(T).FullName.GetHashCode(); 17 18 for (var i = 0; i < source.Count; i++) 19 hash = hash * 31 + source[i].GetHashCode(); 20 21 return hash; 22 } 23 24 public static int HashCode<T>(this IEnumerable<T> source) { 25 var hash = 19 * 31 + typeof(T).FullName.GetHashCode(); 26 27 foreach (var item in source) 28 hash = hash * 31 + item.GetHashCode(); 29 30 return hash; 31 } 14 32 } 15 33 }
Note: See TracChangeset
for help on using the changeset viewer.