赫克托尔获得所有专栏

时间:2014-04-04 18:07:28

标签: hector

我正在尝试使用以下代码,但它表示无效的构造函数ColumnSliceIterator

SliceQuery<String, UUID, String> query = HFactory
                .createSliceQuery(keyspaceOperator, StringSerializer.get(),
                        UUIDSerializer.get(), StringSerializer.get())
                .setKey(login).setColumnFamily(FRIENDS_CF);

        ColumnSliceIterator<String , UUID, String> iterator = new ColumnSliceIterator<String, UUID, String>(query, null, "\uFFFF", false);

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

SliceQuery<String, UUID, String> query = HFactory
                .createSliceQuery(keyspaceOperator, StringSerializer.get(),
                        UUIDSerializer.get(), StringSerializer.get())
                .setKey(login).setColumnFamily(FRIENDS_CF);
        ColumnSliceIterator.ColumnSliceFinish<UUID> FINISH = new ColumnSliceIterator.ColumnSliceFinish<UUID>() {
            @Override
            public UUID function() {
                return TimeUUIDUtils.getUniqueTimeUUIDinMillis();
            }
        };
        ColumnSliceIterator<String, UUID, String> iterator = new ColumnSliceIterator<String, UUID, String>(query, null, FINISH, false, 100);
        List<String> friendIds = new LinkedList<String>();
        while (iterator.hasNext()) {
            friendIds.add(iterator.next().getName().toString());
        }
        return friendIds;