from DataStructures by Paul Richards
Set and map datastructures implemented in pure Matlab

JavaSortedMap()
function map = JavaSortedMap()
%JavaSortedMap Sorted map class which is backed by Java.
%   Uses Java to provide a (fast) sorted (by key) map class.  Since the
%   implementation uses Java the keys can only the types which sensibly
%   convert to Java types (ie scalars).
%   Please use SortedSet unless performance is critical.
%   Also note that this class does not behave in the copy-on-write way that
%   other objects do in Matlab, and it will be an error to use them in
%   such a way.
    map.index = java.util.TreeMap();
    map.data = {};
    map.free_list = [];
    map = class(map, 'JavaSortedMap');
end

Contact us at files@mathworks.com