Creates and returns a listener, which allows to persist the value a list item, which is
clicked by the user.

@return The listener, which has been created, as an instance of the type {@link
OnClickListener}
178448
private OnClickListener createListItemListener() {
        return new OnClickListener() {

            @Override
            public void onClick(final DialogInterface dialog, final int which) {
                selectedIndex = which;
                ListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
                dialog.dismiss();
            }
        };
    }
381538
function createListener (msg) {
  function listener (err) {
    if (msg.__onFinished === listener) msg.__onFinished = null
    if (!listener.queue) return

    var queue = listener.queue
    listener.queue = null

    for (var i = 0; i < queue.length; i++) {
      queue[i](err, msg)
    }
  }

  listener.queue = []

  return listener
}
1236509
public ListenerType<WebAppDescriptor> getOrCreateListener()
   {
      List<Node> nodeList = model.get("listener");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ListenerTypeImpl<WebAppDescriptor>(this, "listener", model, nodeList.get(0));
      }
      return createListener();
   }
1260942
@NonNull
    private View.OnClickListener createNextButtonListener() {
        return new View.OnClickListener() {

            @Override
            public void onClick(final View v) {
                if (navigationFragment != null) {
                    int currentIndex = navigationFragment.getSelectedNavigationPreferenceIndex();

                    if (currentIndex < navigationFragment.getNavigationPreferenceCount() - 1) {
                        Bundle params = notifyOnNextStep();

                        if (params != null) {
                            navigationFragment.selectNavigationPreference(currentIndex + 1, params);
                        }
                    }
                }
            }

        };
    }
1315878
public Listeners<Job<T>> getOrCreateListeners()
   {
      Node node = childNode.getOrCreate("listeners");
      Listeners<Job<T>> listeners = new ListenersImpl<Job<T>>(this, "listeners", childNode, node);
      return listeners;
   }
1371428
public static ListenerAdapter[] createListenerAdapters(EntryListener listener) {
        // We only care about these reference event types for backward compatibility.
        EntryEventType[] values = new EntryEventType[]{ADDED, REMOVED, EVICTED, UPDATED, EVICT_ALL, CLEAR_ALL};
        ListenerAdapter[] listenerAdapters = new ListenerAdapter[values.length];
        for (EntryEventType eventType : values) {
            listenerAdapters[eventType.ordinal()] = createListenerAdapter(eventType, listener);
        }
        return listenerAdapters;
    }
954681
public static <T> Listener<T> createListenerToFire(Event<T> event) {
		return new Listener<T>() {
			@Override
			public void fire(T obj) {
				event.fire(obj);
			}
		};
	}
921521
@Override
    protected <T> List<T> createListenerList(int sizeHint) {
        if (this.optimized) {
            return new CopyOnWriteArrayList<>();
        }
        return super.createListenerList(sizeHint);
    }
1185149
public <K2 extends K, E2 extends E> BlockingListMaker<K2, E2> listenForElements(Listener<K2, E2> listener) {
        @SuppressWarnings("unchecked")
        BlockingListMaker<K2, E2> stricterThis = (BlockingListMaker<K2, E2>) this;
        stricterThis.setListener(listener);
        return stricterThis;
    }
631380
private OnItemClickListener createItemClickListener() {
        return new OnItemClickListener() {

            @Override
            public void onItemClick(final AdapterView<?> parent, final View view,
                                    final int position, final long id) {
                Pair<Integer, Integer> itemPosition =
                        getItemPosition(position - getHeaderViewsCount());
                int groupIndex = itemPosition.first;
                int childIndex = itemPosition.second;
                long packedId;

                if (childIndex != -1) {
                    packedId = getPackedPositionForChild(groupIndex, childIndex);
                    notifyOnChildClicked(view, groupIndex, childIndex, packedId);
                } else if (groupIndex != -1) {
                    packedId = getPackedPositionForGroup(groupIndex);
                    notifyOnGroupClicked(view, groupIndex, packedId);
                } else {
                    packedId = getPackedPositionForChild(Integer.MAX_VALUE, position);
                }

                notifyOnItemClicked(view, getPackedPosition(position), packedId);
            }

        };
    }
1369958
public T clicked(View.OnClickListener listener) {

        if (view != null) {
            view.setOnClickListener(listener);
        }

        return self();
    }
902753
@SuppressWarnings("unchecked")
	public <T extends EventListener> T[] getListeners(Class<T> type) {
		final Object[] iListeners = this.listeners;
		final int listenerCount = getListenerCount(iListeners, type);
		final T[] result = (T[]) Array.newInstance(type, listenerCount);
		int j = 0;
		for (int i = iListeners.length - 2; i >= 0; i -= 2) {
			if (iListeners[i] == type) {
				result[j++] = type.cast(iListeners[i + 1]);
			}
		}
		return result;
	}
1148571
@NonNull
    private TextWatcher createTextChangedListener() {
        return new TextWatcher() {

            @Override
            public void beforeTextChanged(final CharSequence text, final int start, final int count,
                                          final int after) {

            }

            @Override
            public void afterTextChanged(final Editable text) {

            }

            @Override
            public void onTextChanged(final CharSequence text, final int start, final int before,
                                      final int count) {
                EditTextDialogDecorator.this.text = text;

                if (validateOnValueChange) {
                    validate();
                }
            }

        };
    }
446644
private ArrayList getListener()
    {
        if (_listeners != null)
            return _listeners;
        synchronized (this) {
            if (_listeners != null)
                return _listeners;
            _listeners = new ArrayList();
        }
        return _listeners;
    }
1255098
public View.OnClickListener getOnClickListener(boolean adapterHasListener) {
        if (isClickable() && adapterHasListener) {
            if (mViewHolderClickListener == null) {
                mViewHolderClickListener = new ViewHolderClickListener<>(this);
            }
        } else {
            mViewHolderClickListener = null;
        }
        return mViewHolderClickListener;
    }
404373
public ListenerContainer<NodeCacheListener> getListenable()
    {
        Preconditions.checkState(state.get() != State.CLOSED, "Closed");

        return listeners;
    }
1112881
public SynchronizedCollection<EventListener> getListeners() {
		final Object mutex = mutex();
		synchronized (mutex) {
			return Collections3.synchronizedCollection(this.listeners.values(), mutex);
		}
	}