Add "All Media" item as the first row of bucket items.

@param cursor The original data of all bucket items
@return The data with "All Media" item added
325618
private Cursor addAllMediaBucketItem(@Nullable Cursor cursor) {
        if (cursor == null || !cursor.moveToPosition(0)) {
            return null;
        }
        ensureActivityAttached();
        long id = ALL_MEDIA_BUCKET_ID;
        String label = mActivity.getString(R.string.activity_gallery_bucket_all_media);
        String data = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
        MatrixCursor allMediaRow = new MatrixCursor(BUCKET_PROJECTION);
        allMediaRow.newRow()
                .add(id)
                .add(label)
                .add(data);
        return new MergeCursor(new Cursor[]{allMediaRow, cursor});
    }
1174777
public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
        // buffer could be null
        checkNotNull(candidates);

        List<Completion> completions = new ArrayList<Completion>(completers.size());

        // Run each completer, saving its completion results
        int max = -1;
        for (Completer completer : completers) {
            Completion completion = new Completion(candidates);
            completion.complete(completer, buffer, cursor);

            // Compute the max cursor position
            max = Math.max(max, completion.cursor);

            completions.add(completion);
        }

        SortedSet<CharSequence> allCandidates = new TreeSet<>();

        // Append candidates from completions which have the same cursor position as max
        for (Completion completion : completions) {
            if (completion.cursor == max) {
                allCandidates.addAll(completion.candidates);
            }
        }

        candidates.addAll(allCandidates);

        return max;
    }
1021034
static <T> List<T> toList(final Class<T> targetClass, final Cursor cursor, final int columnIndex, int offset, int count) {
        if (columnIndex < 0 || columnIndex >= cursor.getColumnCount()) {
            throw new IllegalArgumentException("Invalid column index: " + columnIndex);
        }

        if (offset > 0) {
            cursor.moveToPosition(offset - 1);
        }

        final List<T> resultList = new ArrayList<>();

        if (N.isEntity(targetClass)) {
            final Method propSetMethod = ClassUtil.getPropSetMethod(targetClass, cursor.getColumnName(columnIndex));
            final Type<T> selectColumnType = Type.valueOf(propSetMethod.getParameterTypes()[0]);

            while (count-- > 0 && cursor.moveToNext()) {
                T entity = N.newEntity(targetClass);
                ClassUtil.setPropValue(entity, propSetMethod, selectColumnType.get(cursor, columnIndex));
                resultList.add(entity);
            }

        } else {
            final Type<T> selectColumnType = Type.valueOf(targetClass);

            while (count-- > 0 && cursor.moveToNext()) {
                resultList.add(selectColumnType.get(cursor, columnIndex));
            }
        }

        return resultList;
    }
1205013
public LienzoPanel setCursor(final Cursor cursor)
    {
        if ((cursor != null) && (cursor != m_active_cursor))
        {
            m_active_cursor = cursor;

            // Need to defer this, sometimes, if the browser is busy, etc, changing cursors does not take effect till events are done processing

            Scheduler.get().scheduleDeferred(new ScheduledCommand()
            {
                @Override
                public void execute()
                {
                    getElement().getStyle().setCursor(m_active_cursor);
                }
            });
        }
        return this;
    }
1346350
public int addItem(final AtomicValue pItem) {
        final int key = mList.size();
        pItem.setNodeKey(key);
        // TODO: +2 is necessary, because key -1 is the NULLDATA
        final int itemKey = (key + 2) * (-1);
        pItem.setNodeKey(itemKey);

        mList.add(pItem);
        return itemKey;
    }
675719
public int addLast(KTypeContainer<? extends KType> container) {
    int size = container.size();
    ensureBufferSpace(size);

    for (KTypeCursor<? extends KType> cursor : container) {
      addLast(cursor.value);
    }

    return size;
  }
1270726
public static <T> MatrixCursor getCursor(final List<T> list) {
        if (list == null || list.isEmpty())
            return new MatrixCursor(new String[] { "_id" });

        final String[] titles = getFieldTitlesFromObject(list.get(0));

        final MatrixCursor cursor = new MatrixCursor(titles);

        try {
            addFieldValuesFromList(cursor, list);
        } catch (final IllegalAccessException e) {
            Logger.ex(e);
        }

        return cursor;
    }
735977
public static <T> LinkedHashSet<T> consumeToLinkedHashSet(IterableCursor<T> cursor) {
        return consumeToCollection(cursor, new LinkedHashSet<T>(cursor.getCount()));
    }
1363509
public static String dumpCurrentRowToString(Cursor cursor) {
        StringBuilder sb = new StringBuilder();
        dumpCurrentRow(cursor, sb);
        return sb.toString();
    }
329313
public ModelAdapter<?, Item> add(List<Item> items) {
        if (mOriginalItems != null && items.size() > 0) {
            if (mItemAdapter.isUseIdDistributor()) {
                mItemAdapter.getIdDistributor().checkIds(items);
            }
            mOriginalItems.addAll(items);
            publishResults(mConstraint, performFiltering(mConstraint));
            return mItemAdapter;
        } else {
            return mItemAdapter.addInternal(items);
        }
    }
52245
public Article addMediaContent(MediaContent mediaContent) {
		if(mediaContent == null)
			return this;

		if(this.mediaContentVec == null)
			this.mediaContentVec = new Vector<>();

		this.mediaContentVec.add(mediaContent);

		return this;
	}
1062950
public CursorList<T> get() {
		final SQLiteDatabase db = Sprinkles.getDatabase();
		final Cursor c = db.rawQuery(rawQuery, null);
		return new CursorList<T>(c, resultClass);
	}
198686
@Api
	public void setCursorString(String cursor) {
		try {
			Cursor c = Cursor.valueOf(cursor.toUpperCase());
			setCursor(c);
		} catch (Exception e) { // NOSONAR
			// Let us assume the cursor points to an image:
			this.cursor = cursor;
			if (!cursor.contains("url")) {
				this.cursor = "url('" + cursor + "'),auto";
			}
			graphics.getRasterContext().setCursor(null, this.cursor);
			graphics.getVectorContext().setCursor(null, this.cursor);
		}
	}
1023692
void add( LessExtend lessExtend, String[] mainSelector ) {
        if( mainSelector == null || mainSelector[0].startsWith( "@media" ) ) {
            mainSelector = lessExtend.getSelectors();
        } else {
            mainSelector = SelectorUtils.merge( mainSelector, lessExtend.getSelectors() );
        }
        String extendingSelector = lessExtend.getExtendingSelector();
        if( lessExtend.isAll() ) {
            LessExtendResult extend = new LessExtendResult( mainSelector, extendingSelector );
            SelectorTokenizer tokenizer = tokenizers.pollLast().init( extendingSelector );
            do {
                String token = tokenizer.next();
                if( token == null ) {
                    break;
                }
                all.add( token, extend );
            } while( true );
            tokenizers.addLast( tokenizer );
        } else {
            exact.add( extendingSelector, mainSelector );
        }
    }
734615
public synchronized GoogleCloudStorageItemInfo putItem(GoogleCloudStorageItemInfo item) {
    StorageResourceId id = item.getResourceId();
    PrefixKey key = new PrefixKey(id.getBucketName(), id.getObjectName());
    CacheValue<GoogleCloudStorageItemInfo> value =
        new CacheValue<GoogleCloudStorageItemInfo>(item, ticker.read());

    CacheValue<GoogleCloudStorageItemInfo> oldValue = itemMap.put(key, value);

    if (oldValue == null) {
      return null;
    }

    if (isExpired(oldValue)) {
      cleanupLists(key);
      return null;
    }

    return oldValue.getValue();
  }
1106067
public Cursor newCursor(String name)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "newCursor", name);

    Cursor cursor = new Cursor(name,this,true);
        
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "newCursor", cursor);
    
    return cursor;
  }
1198750
public void setCursor (Cursor cursor) {
    Element rootElement = graphics.rootElement;
    if (cursor == null) rootElement.getStyle().setProperty("cursor", "none");
    else rootElement.getStyle().setCursor(cursor);
  }