creates a new FastAdapter with the provided adapters
if adapters is null, a default ItemAdapter is defined

@param adapter the adapters which this FastAdapter should use
@return a new FastAdapter
184344
@SuppressWarnings("unchecked")
    public static <Item extends IItem, A extends IAdapter> FastAdapter<Item> with(A adapter) {
        FastAdapter<Item> fastAdapter = new FastAdapter<>();
        fastAdapter.addAdapter(0, adapter);
        return fastAdapter;
    }
549177
public void setAdapter(Adapter adapter) {
        if (mAdapter != null) {
            mAdapter.unregisterAdapterDataObserver(mObserver);
        }
        // end all running animations
        if (mItemAnimator != null) {
            mItemAnimator.endAnimations();
        }
        // Since animations are ended, mLayout.children should be equal to recyclerView.children.
        // This may not be true if item animator's end does not work as expected. (e.g. not release
        // children instantly). It is safer to use mLayout's child count.
        if (mLayout != null) {
            mLayout.removeAndRecycleAllViews(mRecycler);
            mLayout.removeAndRecycleScrapInt(mRecycler, true);
        }

        final Adapter oldAdapter = mAdapter;
        mAdapter = adapter;
        if (adapter != null) {
            adapter.registerAdapterDataObserver(mObserver);
        }
        if (mLayout != null) {
            mLayout.onAdapterChanged(oldAdapter, mAdapter);
        }
        mRecycler.onAdapterChanged(oldAdapter, mAdapter);
        mState.mStructureChanged = true;
        markKnownViewsInvalid();
        requestLayout();
    }
161472
public static <E extends SqlTypeAdapter<?, ?>> E getAdapter(Class<E> clazz) {
		@SuppressWarnings("unchecked")
		E adapter = (E) cache.get(clazz);

		if (adapter == null) {
			try {
				lock.lock();
				adapter = clazz.newInstance();
				cache.put(clazz, adapter);
			} catch(Throwable e) {
				throw(new KriptonRuntimeException(e));
			} finally {
				lock.unlock();
			}
		}

		return adapter;
	}
363438
@Nullable
    public IAdapter<Item> adapter(int order) {
        if (mAdapters.size() <= order) {
            return null;
        }
        return mAdapters.get(order);
    }
161007
def DefaultAdapter(self):
    '''
    '''
    default_adapter = None

    for obj in mockobject.objects.keys():
        if obj.startswith('/org/bluez/') and 'dev_' not in obj:
            default_adapter = obj

    if default_adapter:
        return dbus.ObjectPath(default_adapter, variant_level=1)
    else:
        raise dbus.exceptions.DBusException(
            'No such adapter.', name='org.bluez.Error.NoSuchAdapter')
1100760
function findAdapter(adapters, mediaType, method) {
  for (let i = 0; i < adapters.length; i += 1) {
    if (adapters[i].mediaTypes.indexOf(mediaType) !== -1 && adapters[i][method]) {
      return adapters[i];
    }
  }

  return null;
}
959321
public static <Model, Item extends IItem> ModelAdapter<Model, Item> models(IInterceptor<Model, Item> interceptor) {
        return new ModelAdapter<>(interceptor);
    }
851958
public static int countItems(final IItemAdapter adapter, boolean countHeaders) {
        return countItems(adapter.getAdapterItems(), countHeaders, false, null);
    }
619417
private OnItemClickListener createItemClickListener() {
        return new OnItemClickListener() {

            @Override
            public void onItemClick(final AdapterView<?> parent, final View view,
                                    final int position, final long id) {
                if (itemClickListener != null && !rootView.isDragging() &&
                        !rootView.isAnimationRunning()) {
                    int index = position;

                    if (adapter.containsDividers()) {
                        for (int i = position; i >= 0; i--) {
                            if (adapter.getItem(i) == null ||
                                    (adapter.getItem(i) instanceof Divider &&
                                            i % adapter.getColumnCount() > 0)) {
                                index--;
                            }
                        }
                    }

                    itemClickListener.onItemClick(parent, view, index, getId(position));
                }

                dismiss();
            }

        };
    }
1162776
public void setAdapter(@NonNull ListAdapter adapter) {
    this.adapter = new MaterialSpinnerAdapterWrapper(getContext(), adapter)
        .setPopupPadding(popupPaddingLeft, popupPaddingTop, popupPaddingRight, popupPaddingBottom)
        .setBackgroundSelector(backgroundSelector)
        .setTextColor(textColor);
    setAdapterInternal(this.adapter);
  }
827191
public static <A extends FastItemAdapter<Item>, Item extends IItem> A set(final A adapter, final List<Item> items, final DiffCallback<Item> callback, final boolean detectMoves) {
        set(adapter.getItemAdapter(), items, callback, detectMoves);
        return adapter;
    }
344849
private static Adapter tryAdapter( Class adapterClass, Object externalContext )
    {
        try
        {
            Adapter sa = ( Adapter ) adapterClass.newInstance();

            try
            {
                AdapterContext context = new AdapterContext( externalContext );
                
                if ( sa.accept( context ) )
                {
                    _log.info( "Adapter " + adapterClass.getName() + " accepted." );
                    sa.setContext( context );
                    return sa;
                }
                else
                {
                    _log.info( "Adapter " + adapterClass.getName() + " is present but did not accept." );
                }
            }
            catch ( Exception e )
            {
                _log.error( adapterClass.getName() + ".accept() threw an exception.", e );
            }
            catch ( LinkageError e )
            {
                _log.error( adapterClass.getName() + ".accept() caused a linkage error and may be out of date.", e );
            }
        }
        catch ( InstantiationException e )
        {
            _log.error( "Could not create instance of Adapter class " + adapterClass.getName(), e );
        }
        catch ( IllegalAccessException e )
        {
            _log.error( "Could not create instance of Adapter class " + adapterClass.getName(), e );
        }
        catch ( Exception e )
        {
            _log.error( "Error creating instance of Adapter class " + adapterClass.getName(), e );
        }

        return null;
    }
705275
public void setAdapter(RecyclerView.Adapter adapter) {
        if (mWrappedAdapter != null && mWrappedAdapter.getItemCount() > 0) {
            notifyItemRangeRemoved(getHeaderCount(), mWrappedAdapter.getItemCount());
        }
        setWrappedAdapter(adapter);
        notifyItemRangeInserted(getHeaderCount(), mWrappedAdapter.getItemCount());
    }
721129
@Override
    public void setAdapter(SpinnerAdapter adapter) {
        if (null != mAdapter) {
            mAdapter.unregisterDataSetObserver(mDataSetObserver);
            resetList();
        }

        mAdapter = adapter;

        mOldSelectedPosition = INVALID_POSITION;
        mOldSelectedRowId = INVALID_ROW_ID;

        if (mAdapter != null) {
            mOldItemCount = mItemCount;
            mItemCount = mAdapter.getCount();
            checkFocus();

            mDataSetObserver = new AdapterDataSetObserver();
            mAdapter.registerDataSetObserver(mDataSetObserver);

            int position = mItemCount > 0 ? 0 : INVALID_POSITION;

            setSelectedPositionInt(position);
            setNextSelectedPositionInt(position);

            if (mItemCount == 0) {
                // Nothing selected
                checkSelectionChanged();
            }

        } else {
            checkFocus();
            resetList();
            // Nothing selected
            checkSelectionChanged();
        }

        requestLayout();
    }
63112
@Deprecated
    public static Set<IItem> getSelectedItems(FastAdapter adapter) {
        Set<IItem> selections = new HashSet<>();
        int length = adapter.getItemCount();
        List<IItem> items = new ArrayList<>();
        for (int i = 0; i < length; i++) {
            items.add(adapter.getItem(i));
        }
        updateSelectedItemsWithCollapsed(selections, items);
        return selections;
    }
807356
@SuppressWarnings({"unchecked", "rawtypes"})
    public T adapter(Adapter adapter) {

        if (view instanceof AdapterView) {
            AdapterView av = (AdapterView) view;
            av.setAdapter(adapter);
        }
        return self();
    }
398855
public final void setAdapter(@Nullable final ExpandableListAdapter adapter) {
        expandedGroups.clear();

        if (adapter != null) {
            this.adapter = new AdapterWrapper(adapter);
            super.setAdapter(this.adapter);
        } else {
            this.adapter = null;
            super.setAdapter(null);
        }
    }