1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.example;
14 import org.simantics.databoard.Bindings;
15 import org.simantics.databoard.binding.Binding;
16 import org.simantics.databoard.binding.error.BindingException;
18 public class DeepHashcode {
20 public static void main(String[] args) throws BindingException {
22 // Binding can calculate deep hashcode for any instance
23 Binding binding = Bindings.getBindingUnchecked( int[].class );
25 int[] array1 = new int[] { 1, 2, 3 };
26 int[] array2 = new int[] { 1, 2, 3 };
27 int[] array3 = new int[] { 2, 3, 4 };
29 System.out.println( "Hashcode for array1 is " + binding.hashValue( array1 ) );
30 System.out.println( "Hashcode for array2 is " + binding.hashValue( array2 ) );
31 System.out.println( "Hashcode for array3 is " + binding.hashValue( array3 ) );