java - subset based on index from google guava TreeBasedTable -
i have treebasedtable<string,string,customtype>
structure need able subsets based on start
, end
range indices, fromindex
toindex
. cellset
method doesn't return sortedset
. best approach this?
i thought of doing lists.newarraylist(structure.cellset()).sublist(start,end)
, doesn't efficient thing do.
if startindex
, endindex
integer positions, arraylist
implementation isn't far off best that's feasible, though it'd more efficient write
fluentiterable.from(table.cellset()).skip(fromindex).limit(toindex).tolist()
that implementation won't copy more of elements has result list.
generally speaking, there's not efficient way arbitrary sortedset
, sortedmap
, or pretty of sorted data structures come java.
Comments
Post a Comment