我正在使用android绘图库来绘制我拥有的数组中的数据。问题是当数组中存在重复数据时,y轴的某些数字标签也会被复制。 例如,如果我有一个数组
{46.66,46.50,46.61,46.61,46.55,46.55,46.60,46.50,46.50,46.50,46.61,46.41,46.54,46.44,46.46,46.55,46.59,46.61,46.64,46.60,46.65,46.74,46.74, 46.99,46.95,46.94,46.80,46.98,46.90,46.94,47.00,46.94,47.11 }
我在y轴上重复了46.6和47。
抱歉,由于声誉不佳,我无法发布图片。
答案 0 :(得分:0)
您可以考虑将Set
用于唯一值,不允许重复:
不包含重复元素的集合。更正式的,集合 不包含元素e1和e2对,使得e1.equals(e2)和at 大多数一个null元素。正如其名称所暗示的,这个界面模型 数学集抽象。
如果您决定坚持使用ArrayList
,那么有许多关于删除重复项或使扩展类禁止添加相同值的帖子: