% Shows that element/2 can use Java typed and list-based patterns to find matching elements.

:- eval(element_matching()).

element_matching() :-
	L = java.util.ArrayList(),
	L.add([X,2]),
	L.add([Integer.I,Double.D]),
	L.add([2.14,Double.D]),
	L.add([3,"toto"]),
	element([Integer.N,X],L),
	println([Integer.N,X],",").

% Prints:
% <Integer.N>,2
% <Integer.N>,<java.lang.Double.@@9>
% 3,toto