_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q14200
SSLTools.validCertificateString
train
public static boolean validCertificateString(String certificateString) { try { byte[] certBytes = parseDERFromPEM(certificateString, CERT_START, CERT_END); generateCertificateFromDER(certBytes); } catch (Exception e) { return false; } return true; }
java
{ "resource": "" }
q14201
RESTClient.urlParameter
train
public RESTClient<RS, ERS> urlParameter(String name, Object value) { if (value == null) { return this; } List<Object> values = this.parameters.get(name); if (values == null) { values = new ArrayList<>(); this.parameters.put(name, values); } if (value instanceof ZonedDateTime)...
java
{ "resource": "" }
q14202
WebSocketClassLoader.findResources
train
@Override protected Enumeration<URL> findResources(String name) { URL url = findResource(name); Vector<URL> urls = new Vector<>(); if (url != null) { urls.add(url); } return urls.elements(); }
java
{ "resource": "" }
q14203
ConfigurationsCatalog.unsetUserConfigurations
train
public void unsetUserConfigurations(UserConfigurationsProvider provider) { if (userConfigurations.isPresent() && userConfigurations.get().equals(provider)) { this.userConfigurations = Optional.empty(); } }
java
{ "resource": "" }
q14204
Artefact.getAttribute
train
public Attribute getAttribute(final String attributeName) { final Attribute a = attributes.get(attributeName); if (a == null) throw new IllegalArgumentException("Attribute " + attributeName + " doesn't exists"); return a; }
java
{ "resource": "" }
q14205
Artefact.addAttributeValue
train
public void addAttributeValue(final String attributeName, final Value attributeValue, Environment in) { if (in == null) in = GlobalEnvironment.INSTANCE; Attribute attr = attributes.get(attributeName); if (attr == null) { attr = new Attribute(attributeName); attributes.put(attr.getName(), attr); } att...
java
{ "resource": "" }
q14206
HttpServer.onClose
train
@Handler public void onClose(Close event, WebAppMsgChannel appChannel) throws InterruptedException { appChannel.handleClose(event); }
java
{ "resource": "" }
q14207
HttpServer.onOptions
train
@Handler(priority = Integer.MIN_VALUE) public void onOptions(Request.In.Options event, IOSubchannel appChannel) { if (event.requestUri() == HttpRequest.ASTERISK_REQUEST) { HttpResponse response = event.httpRequest().response().get(); response.setStatus(HttpStatus.OK); app...
java
{ "resource": "" }
q14208
Pattern.matcher
train
public Matcher matcher(CharSequence s) { Matcher m = new Matcher(this); m.setTarget(s); return m; }
java
{ "resource": "" }
q14209
Pattern.matcher
train
public Matcher matcher(char[] data, int start, int end) { Matcher m = new Matcher(this); m.setTarget(data, start, end); return m; }
java
{ "resource": "" }
q14210
Pattern.matcher
train
public Matcher matcher(MatchResult res, String groupName) { Integer id = res.pattern().groupId(groupName); if (id == null) throw new IllegalArgumentException("group not found:" + groupName); int group = id; return matcher(res, group); }
java
{ "resource": "" }
q14211
ColumnRelation.toList
train
public List<ColumnRelation> toList() { List<ColumnRelation> ret = new ArrayList<>(); ret.add(this); if (getNextRelation().isPresent()) { ret.addAll(getNextRelation().get().toList()); } return ret; }
java
{ "resource": "" }
q14212
DataSourceUtils.addToDataSource
train
public static void addToDataSource(DataSource parent, DataSource child) { if (!parent.getLeftDataSource().isPresent()) { parent.setLeftDataSource(child); } else if (!parent.getRightDataSource().isPresent()) { parent.setRightDataSource(child); } else { DataSour...
java
{ "resource": "" }
q14213
DefaultFormatter.format
train
@Override public String format (LogRecord logRecord) { StringBuilder resultBuilder = new StringBuilder (); String prefix = logRecord.getLevel ().getName () + "\t"; resultBuilder.append (prefix); resultBuilder.append (Thread.currentThread ().getName ()) .append (" ") .append (sdf.format (new java.util...
java
{ "resource": "" }
q14214
UserOption.acceptsValue
train
public boolean acceptsValue(String value) { if (value==null) { return false; } else if (hasValues()) { return getValuesList().contains(value); } else { return true; } }
java
{ "resource": "" }
q14215
JacksonRequest.getUrl
train
private static String getUrl(int method, String baseUrl, String endpoint, Map<String, String> params) { if (params != null) { for (Map.Entry<String, String> entry : params.entrySet()) { if (entry.getValue() == null || entry.getValue().equals("null")) { entry.setValue(""); } } } if (method == M...
java
{ "resource": "" }
q14216
LogHelperConfigurator.configure
train
public static boolean configure (File configFile) { boolean goOn = true; if (!configFile.exists ()) { LogHelperDebug.printError ("File " + configFile.getAbsolutePath () + " does not exist", false); goOn = false; } DocumentBuilderFactory documentBuilderFactory = null; DocumentBuilder documentBuilder = ...
java
{ "resource": "" }
q14217
LogHelperConfigurator.configureLoggerWrapper
train
private static void configureLoggerWrapper (Node configNode) { Node lwNameNode = configNode.getAttributes ().getNamedItem ("name"); String lwName; if (lwNameNode != null) { lwName = lwNameNode.getTextContent (); } else { lwName = "LoggerWrapper_" + String.valueOf ((new Date ()).getTime ()); } LoggerW...
java
{ "resource": "" }
q14218
PermitsPool.removeListener
train
public PermitsPool removeListener(AvailabilityListener listener) { synchronized (listeners) { for (Iterator<WeakReference<AvailabilityListener>> iter = listeners.iterator(); iter.hasNext();) { WeakReference<AvailabilityListener> item = iter.next(); if ...
java
{ "resource": "" }
q14219
Components.className
train
public static String className(Class<?> clazz) { if (CoreUtils.classNames.isLoggable(Level.FINER)) { return clazz.getName(); } else { return simpleClassName(clazz); } }
java
{ "resource": "" }
q14220
Components.schedule
train
public static Timer schedule( TimeoutHandler timeoutHandler, Instant scheduledFor) { return scheduler.schedule(timeoutHandler, scheduledFor); }
java
{ "resource": "" }
q14221
Components.schedule
train
public static Timer schedule( TimeoutHandler timeoutHandler, Duration scheduledFor) { return scheduler.schedule( timeoutHandler, Instant.now().plus(scheduledFor)); }
java
{ "resource": "" }
q14222
Util.encodePostBody
train
@Deprecated public static String encodePostBody(Bundle parameters, String boundary) { if (parameters == null) return ""; StringBuilder sb = new StringBuilder(); for (String key : parameters.keySet()) { Object parameter = parameters.get(key); if (!(parameter instanceo...
java
{ "resource": "" }
q14223
Util.parseUrl
train
@Deprecated public static Bundle parseUrl(String url) { // hack to prevent MalformedURLException url = url.replace("fbconnect", "http"); try { URL u = new URL(url); Bundle b = decodeUrl(u.getQuery()); b.putAll(decodeUrl(u.getRef())); return b; ...
java
{ "resource": "" }
q14224
Util.openUrl
train
@Deprecated public static String openUrl(String url, String method, Bundle params) throws MalformedURLException, IOException { // random string as boundary for multi-part http post String strBoundary = "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f"; String endLine = "\r\n"; Ou...
java
{ "resource": "" }
q14225
NativeAppCallContentProvider.getAttachmentUrl
train
public static String getAttachmentUrl(String applicationId, UUID callId, String attachmentName) { return String.format("%s%s/%s/%s", ATTACHMENT_URL_BASE, applicationId, callId.toString(), attachmentName); }
java
{ "resource": "" }
q14226
CharArrayList.set
train
@Deprecated public Character set(final int index, final Character ok) { return set(index, ok.charValue()); }
java
{ "resource": "" }
q14227
CharArrayList.getElements
train
private void getElements(final int from, final char[] a, final int offset, final int length) { CharArrays.ensureOffsetLength(a, offset, length); System.arraycopy(this.a, from, a, offset, length); }
java
{ "resource": "" }
q14228
CharArrayList.removeElements
train
public void removeElements(final int from, final int to) { CharArrays.ensureFromTo(size, from, to); System.arraycopy(a, to, a, from, size - to); size -= (to - from); }
java
{ "resource": "" }
q14229
CharArrayList.addElements
train
public void addElements(final int index, final char a[], final int offset, final int length) { ensureIndex(index); CharArrays.ensureOffsetLength(a, offset, length); grow(size + length); System.arraycopy(this.a, index, this.a, index + length, size - index); System.arraycopy(a, off...
java
{ "resource": "" }
q14230
CharArrayList.ensureIndex
train
private void ensureIndex(final int index) { if (index < 0) throw new IndexOutOfBoundsException("Index (" + index + ") is negative"); if (index > size()) throw new IndexOutOfBoundsException("Index (" + index + ") is greater than list size (" + (size()) + ")"); }
java
{ "resource": "" }
q14231
CharArrayList.ensureRestrictedIndex
train
protected void ensureRestrictedIndex(final int index) { if (index < 0) throw new IndexOutOfBoundsException("Index (" + index + ") is negative"); if (index >= size()) throw new IndexOutOfBoundsException("Index (" + index + ") is greater than or equal to list size (" + (size()) + ")"); }
java
{ "resource": "" }
q14232
CharArrayList.containsAll
train
public boolean containsAll(Collection<?> c) { int n = c.size(); final Iterator<?> i = c.iterator(); while (n-- != 0) if (!contains(i.next())) return false; return true; }
java
{ "resource": "" }
q14233
CharArrayList.addAll
train
public boolean addAll(Collection<? extends Character> c) { boolean retVal = false; final Iterator<? extends Character> i = c.iterator(); int n = c.size(); while (n-- != 0) if (add(i.next())) retVal = true; return retVal; }
java
{ "resource": "" }
q14234
UserConfigurationsCollection.getConfigurationDetails
train
public synchronized Set<ConfigurationDetails> getConfigurationDetails() { return inventory.entries().stream() .map(c->c.getConfiguration().orElse(null)) .filter(v->v!=null) .map(v->v.getDetails()) .collect(Collectors.toSet()); }
java
{ "resource": "" }
q14235
UserConfigurationsCollection.getConfiguration
train
public synchronized Map<String, Object> getConfiguration(String key) { return Optional.ofNullable(inventory.get(key)) .flatMap(v->v.getConfiguration()) .map(v->v.getMap()) .orElse(null); }
java
{ "resource": "" }
q14236
UserConfigurationsCollection.addConfiguration
train
public synchronized Optional<String> addConfiguration(String niceName, String description, Map<String, Object> config) { try { if (catalog==null) { throw new FileNotFoundException(); } return sync(()-> { ConfigurationDetails p = new ConfigurationDetails.Builder(inventory.nextIdentifier()) .nice...
java
{ "resource": "" }
q14237
UserConfigurationsCollection.removeConfiguration
train
public synchronized boolean removeConfiguration(String key) { try { if (catalog==null) { throw new FileNotFoundException(); } return sync(()->inventory.remove(key)!=null); } catch (IOException e) { logger.log(Level.WARNING, "Failed to remove configuration.", e); return false; } }
java
{ "resource": "" }
q14238
UserConfigurationsCollection.cleanupInventory
train
private boolean cleanupInventory() { boolean modified = false; modified |= removeUnreadable(); modified |= recreateMismatching(); modified |= importConfigurations(); return modified; }
java
{ "resource": "" }
q14239
UserConfigurationsCollection.removeUnreadable
train
private boolean removeUnreadable() { List<File> unreadable = inventory.removeUnreadable(); unreadable.forEach(v->v.delete()); return !unreadable.isEmpty(); }
java
{ "resource": "" }
q14240
UserConfigurationsCollection.recreateMismatching
train
private boolean recreateMismatching() { List<Configuration> mismatching = inventory.removeMismatching(); mismatching.forEach(entry->{ try { inventory.add(InventoryEntry.create(entry.copyWithIdentifier(inventory.nextIdentifier()), newConfigurationFile())); } catch (IOException e1) { logger.log(Level.WA...
java
{ "resource": "" }
q14241
UserConfigurationsCollection.importConfigurations
train
private boolean importConfigurations() { // Create a set of files in the inventory Set<File> files = inventory.entries().stream().map(v->v.getPath()).collect(Collectors.toSet()); List<File> entriesToImport = Arrays.asList(baseDir.listFiles(f-> f.isFile() && !f.equals(catalog) // Exclude the master catalog (...
java
{ "resource": "" }
q14242
Event.channels
train
@SuppressWarnings({ "unchecked", "PMD.ShortVariable", "PMD.AvoidDuplicateLiterals" }) public <C> C[] channels(Class<C> type) { return Arrays.stream(channels) .filter(c -> type.isAssignableFrom(c.getClass())).toArray( size -> (C[]) Array.newInstance(type, size)); }
java
{ "resource": "" }
q14243
Event.forChannels
train
@SuppressWarnings({ "unchecked", "PMD.ShortVariable" }) public <E extends EventBase<?>, C extends Channel> void forChannels( Class<C> type, BiConsumer<E, C> handler) { Arrays.stream(channels) .filter(c -> type.isAssignableFrom(c.getClass())) .forEach(c -> handler.accept((...
java
{ "resource": "" }
q14244
Event.setResult
train
public Event<T> setResult(T result) { synchronized (this) { if (results == null) { // Make sure that we have a valid result before // calling decrementOpen results = new ArrayList<T>(); results.add(result); firstResultAs...
java
{ "resource": "" }
q14245
Event.currentResults
train
protected List<T> currentResults() { return results == null ? Collections.emptyList() : Collections.unmodifiableList(results); }
java
{ "resource": "" }
q14246
PeasyViewHolder.inflateView
train
public static View inflateView(LayoutInflater inflater, ViewGroup parent, int layoutId) { return inflater.inflate(layoutId, parent, false); }
java
{ "resource": "" }
q14247
PeasyViewHolder.GetViewHolder
train
public static <VH extends PeasyViewHolder> VH GetViewHolder(PeasyViewHolder vh, Class<VH> cls) { return cls.cast(vh); }
java
{ "resource": "" }
q14248
PeasyViewHolder.bindWith
train
<T> void bindWith(final PeasyRecyclerView<T> binder, final int viewType) { this.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = getLayoutPosition(); position = (position <= binder.getLastItemI...
java
{ "resource": "" }
q14249
ComponentTree.fire
train
@SuppressWarnings("PMD.UseVarargs") public void fire(Event<?> event, Channel[] channels) { eventPipeline.add(event, channels); }
java
{ "resource": "" }
q14250
ComponentTree.dispatch
train
@SuppressWarnings("PMD.UseVarargs") /* default */ void dispatch(EventPipeline pipeline, EventBase<?> event, Channel[] channels) { HandlerList handlers = getEventHandlers(event, channels); handlers.process(pipeline, event); }
java
{ "resource": "" }
q14251
IOUtils.readlineFromStdIn
train
public static String readlineFromStdIn() throws IOException { StringBuilder ret = new StringBuilder(); int c; while ((c = System.in.read()) != '\n' && c != -1) { if (c != '\r') ret.append((char) c); } return ret.toString(); }
java
{ "resource": "" }
q14252
FacebookFragment.getSessionState
train
protected final SessionState getSessionState() { if (sessionTracker != null) { Session currentSession = sessionTracker.getSession(); return (currentSession != null) ? currentSession.getState() : null; } return null; }
java
{ "resource": "" }
q14253
FacebookFragment.getAccessToken
train
protected final String getAccessToken() { if (sessionTracker != null) { Session currentSession = sessionTracker.getOpenSession(); return (currentSession != null) ? currentSession.getAccessToken() : null; } return null; }
java
{ "resource": "" }
q14254
FacebookFragment.getExpirationDate
train
protected final Date getExpirationDate() { if (sessionTracker != null) { Session currentSession = sessionTracker.getOpenSession(); return (currentSession != null) ? currentSession.getExpirationDate() : null; } return null; }
java
{ "resource": "" }
q14255
FacebookFragment.closeSessionAndClearTokenInformation
train
protected final void closeSessionAndClearTokenInformation() { if (sessionTracker != null) { Session currentSession = sessionTracker.getOpenSession(); if (currentSession != null) { currentSession.closeAndClearTokenInformation(); } } }
java
{ "resource": "" }
q14256
FacebookFragment.getSessionPermissions
train
protected final List<String> getSessionPermissions() { if (sessionTracker != null) { Session currentSession = sessionTracker.getSession(); return (currentSession != null) ? currentSession.getPermissions() : null; } return null; }
java
{ "resource": "" }
q14257
FacebookFragment.openSessionForRead
train
protected final void openSessionForRead(String applicationId, List<String> permissions, SessionLoginBehavior behavior, int activityCode) { openSession(applicationId, permissions, behavior, activityCode, SessionAuthorizationType.READ); }
java
{ "resource": "" }
q14258
AppLinkData.fetchDeferredAppLinkData
train
public static void fetchDeferredAppLinkData( Context context, String applicationId, final CompletionHandler completionHandler) { Validate.notNull(context, "context"); Validate.notNull(completionHandler, "completionHandler"); if (applicationId == null) { ...
java
{ "resource": "" }
q14259
AppLinkData.createFromActivity
train
public static AppLinkData createFromActivity(Activity activity) { Validate.notNull(activity, "activity"); Intent intent = activity.getIntent(); if (intent == null) { return null; } AppLinkData appLinkData = createFromAlApplinkData(intent); if (appLinkData == ...
java
{ "resource": "" }
q14260
Matcher.setPattern
train
public void setPattern(Pattern regex) { this.re = regex; int memregCount, counterCount, lookaheadCount; if ((memregCount = regex.memregs) > 0) { MemReg[] memregs = new MemReg[memregCount]; for (int i = 0; i < memregCount; i++) { memregs[i] = new MemRe...
java
{ "resource": "" }
q14261
Matcher.skip
train
public void skip() { int we = wEnd; if (wOffset == we) { //requires special handling //if no variants at 'wOutside',advance pointer and clear if (top == null) { wOffset++; flush(); } //otherwise, if there exist a variant, ...
java
{ "resource": "" }
q14262
Matcher.flush
train
public void flush() { top = null; defaultEntry.reset(0); first.reset(minQueueLength); for (int i = memregs.length - 1; i > 0; i--) { MemReg mr = memregs[i]; mr.in = mr.out = -1; } /* for (int i = memregs.length - 1; i > 0; i--) { ...
java
{ "resource": "" }
q14263
Matcher.start
train
@Override public int start(String name) { Integer id = re.groupId(name); if (id == null) throw new IllegalArgumentException("<" + name + "> isn't defined"); return start(id); }
java
{ "resource": "" }
q14264
Matcher.repeat
train
private static int repeat(char[] data, int off, int out, Term term) { switch (term.type) { case Term.CHAR: { char c = term.c; int i = off; while (i < out) { if (data[i] != c) break; i++; } ...
java
{ "resource": "" }
q14265
Matcher.find
train
private static int find(char[] data, int off, int out, Term term) { if (off >= out) return -1; switch (term.type) { case Term.CHAR: { char c = term.c; int i = off; while (i < out) { if (data[i] == c) break; ...
java
{ "resource": "" }
q14266
FacebookDialog.present
train
public PendingCall present() { logDialogActivity(activity, fragment, getEventName(appCall.getRequestIntent()), AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_COMPLETED); if (onPresentCallback != null) { try { onPresentCallback.onPresent(activity); ...
java
{ "resource": "" }
q14267
FacebookDialog.handleActivityResult
train
public static boolean handleActivityResult(Context context, PendingCall appCall, int requestCode, Intent data, Callback callback) { if (requestCode != appCall.getRequestCode()) { return false; } if (attachmentStore != null) { attachmentStore.cleanupAttachment...
java
{ "resource": "" }
q14268
FacebookDialog.canPresentShareDialog
train
public static boolean canPresentShareDialog(Context context, ShareDialogFeature... features) { return handleCanPresent(context, EnumSet.of(ShareDialogFeature.SHARE_DIALOG, features)); }
java
{ "resource": "" }
q14269
FacebookDialog.canPresentMessageDialog
train
public static boolean canPresentMessageDialog(Context context, MessageDialogFeature... features) { return handleCanPresent(context, EnumSet.of(MessageDialogFeature.MESSAGE_DIALOG, features)); }
java
{ "resource": "" }
q14270
FacebookDialog.canPresentOpenGraphActionDialog
train
public static boolean canPresentOpenGraphActionDialog(Context context, OpenGraphActionDialogFeature... features) { return handleCanPresent(context, EnumSet.of(OpenGraphActionDialogFeature.OG_ACTION_DIALOG, features)); }
java
{ "resource": "" }
q14271
FacebookDialog.canPresentOpenGraphMessageDialog
train
public static boolean canPresentOpenGraphMessageDialog(Context context, OpenGraphMessageDialogFeature... features) { return handleCanPresent(context, EnumSet.of(OpenGraphMessageDialogFeature.OG_MESSAGE_DIALOG, features)); }
java
{ "resource": "" }
q14272
LocaleBasedEnvironment.reduceVariant
train
private static String reduceVariant(final String variant){ if (isEmpty(variant)) throw new AssertionError("Shouldn't happen, can't reduce non existent variant"); int indexOfUnderscore = variant.lastIndexOf('_'); if (indexOfUnderscore==-1) return ""; return variant.substring(0, indexOfUnderscore); }
java
{ "resource": "" }
q14273
TypedIdKey.associate
train
@SuppressWarnings({ "unchecked" }) public static <V> V associate(Associator associator, Serializable id, V value) { associator.setAssociated( new TypedIdKey<V>((Class<V>) value.getClass(), id), value); return value; }
java
{ "resource": "" }
q14274
TypedIdKey.put
train
@SuppressWarnings({ "unchecked" }) public static <V> V put(Map<? super TypedIdKey<V>, ? super V> map, Serializable id, V value) { map.put(new TypedIdKey<V>((Class<V>) value.getClass(), id), value); return value; }
java
{ "resource": "" }
q14275
TypedIdKey.associated
train
public static <V> Optional<V> associated(Associator associator, Class<V> type, Serializable id) { return associator.associated(new TypedIdKey<>(type, id), type); }
java
{ "resource": "" }
q14276
TypedIdKey.get
train
@SuppressWarnings({ "unchecked" }) public static <V> Optional<V> get(Map<?, ?> map, Class<V> type, Serializable id) { return Optional .ofNullable((V) map.get(new TypedIdKey<>(type, id))); }
java
{ "resource": "" }
q14277
BaseFolder.with
train
public static BaseFolder with(String first, String... more) { return new BaseFolder(Paths.get(first, more)); }
java
{ "resource": "" }
q14278
GeneratorRegistry.add
train
@SuppressWarnings({ "PMD.GuardLogStatement", "PMD.AvoidDuplicateLiterals" }) public void add(Object obj) { synchronized (this) { running += 1; if (generators != null) { generators.put(obj, null); generatorTracking.finest(() -> "Added generator " + obj ...
java
{ "resource": "" }
q14279
GeneratorRegistry.remove
train
@SuppressWarnings("PMD.GuardLogStatement") public void remove(Object obj) { synchronized (this) { running -= 1; if (generators != null) { generators.remove(obj); generatorTracking.finest(() -> "Removed generator " + obj + ", " + gen...
java
{ "resource": "" }
q14280
GeneratorRegistry.awaitExhaustion
train
@SuppressWarnings({ "PMD.CollapsibleIfStatements", "PMD.GuardLogStatement" }) public void awaitExhaustion() throws InterruptedException { synchronized (this) { if (generators != null) { if (running != generators.size()) { generatorTracking ...
java
{ "resource": "" }
q14281
GeneratorRegistry.awaitExhaustion
train
@SuppressWarnings({ "PMD.CollapsibleIfStatements", "PMD.GuardLogStatement" }) public boolean awaitExhaustion(long timeout) throws InterruptedException { synchronized (this) { if (generators != null) { if (running != generators.size()) { gen...
java
{ "resource": "" }
q14282
TaskSystemInformation.matchesLocale
train
public boolean matchesLocale(String loc) { return getLocale()==null || (getLocale().isPresent() && getLocale().get().startsWith(loc)); }
java
{ "resource": "" }
q14283
Request.newPostRequest
train
public static Request newPostRequest(Session session, String graphPath, GraphObject graphObject, Callback callback) { Request request = new Request(session, graphPath, null, HttpMethod.POST , callback); request.setGraphObject(graphObject); return request; }
java
{ "resource": "" }
q14284
Request.newMeRequest
train
public static Request newMeRequest(Session session, final GraphUserCallback callback) { Callback wrapper = new Callback() { @Override public void onCompleted(Response response) { if (callback != null) { callback.onCompleted(response.getGraphObjectAs(Gr...
java
{ "resource": "" }
q14285
Request.newMyFriendsRequest
train
public static Request newMyFriendsRequest(Session session, final GraphUserListCallback callback) { Callback wrapper = new Callback() { @Override public void onCompleted(Response response) { if (callback != null) { callback.onCompleted(typedListFromResp...
java
{ "resource": "" }
q14286
Request.newUploadPhotoRequest
train
public static Request newUploadPhotoRequest(Session session, Bitmap image, Callback callback) { Bundle parameters = new Bundle(1); parameters.putParcelable(PICTURE_PARAM, image); return new Request(session, MY_PHOTOS, parameters, HttpMethod.POST, callback); }
java
{ "resource": "" }
q14287
Request.newUploadPhotoRequest
train
public static Request newUploadPhotoRequest(Session session, File file, Callback callback) throws FileNotFoundException { ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); Bundle parameters = new Bundle(1); parameters.putParcelabl...
java
{ "resource": "" }
q14288
Request.newUploadVideoRequest
train
public static Request newUploadVideoRequest(Session session, File file, Callback callback) throws FileNotFoundException { ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); Bundle parameters = new Bundle(1); parameters.putParcelabl...
java
{ "resource": "" }
q14289
Request.newGraphPathRequest
train
public static Request newGraphPathRequest(Session session, String graphPath, Callback callback) { return new Request(session, graphPath, null, null, callback); }
java
{ "resource": "" }
q14290
Request.newPlacesSearchRequest
train
public static Request newPlacesSearchRequest(Session session, Location location, int radiusInMeters, int resultsLimit, String searchText, final GraphPlaceListCallback callback) { if (location == null && Utility.isNullOrEmpty(searchText)) { throw new FacebookException("Either location or ...
java
{ "resource": "" }
q14291
Request.newPostOpenGraphActionRequest
train
public static Request newPostOpenGraphActionRequest(Session session, OpenGraphAction openGraphAction, Callback callback) { if (openGraphAction == null) { throw new FacebookException("openGraphAction cannot be null"); } if (Utility.isNullOrEmpty(openGraphAction.getType()))...
java
{ "resource": "" }
q14292
Request.newDeleteObjectRequest
train
public static Request newDeleteObjectRequest(Session session, String id, Callback callback) { return new Request(session, id, null, HttpMethod.DELETE, callback); }
java
{ "resource": "" }
q14293
ConfigurationSourceKey.propertyFile
train
public static final ConfigurationSourceKey propertyFile(final String name){ return new ConfigurationSourceKey(Type.FILE, Format.PROPERTIES, name); }
java
{ "resource": "" }
q14294
ConfigurationSourceKey.xmlFile
train
public static final ConfigurationSourceKey xmlFile(final String name){ return new ConfigurationSourceKey(Type.FILE, Format.XML, name); }
java
{ "resource": "" }
q14295
ConfigurationSourceKey.jsonFile
train
public static final ConfigurationSourceKey jsonFile(final String name){ return new ConfigurationSourceKey(Type.FILE, Format.JSON, name); }
java
{ "resource": "" }
q14296
Utility.isSubset
train
public static <T> boolean isSubset(Collection<T> subset, Collection<T> superset) { if ((superset == null) || (superset.size() == 0)) { return ((subset == null) || (subset.size() == 0)); } HashSet<T> hash = new HashSet<T>(superset); for (T t : subset) { if (!hash....
java
{ "resource": "" }
q14297
ImageResponseCache.getCachedImageStream
train
static InputStream getCachedImageStream(URI url, Context context) { InputStream imageStream = null; if (url != null) { if (isCDNURL(url)) { try { FileLruCache cache = getCache(context); imageStream = cache.get(url.toString()); ...
java
{ "resource": "" }
q14298
DynamicEnvironment.reduceThis
train
public void reduceThis(){ if (elements==null || elements.isEmpty()) throw new AssertionError("Can't reduce this environment"); elements.remove(elements.size()-1); }
java
{ "resource": "" }
q14299
DynamicEnvironment.parse
train
public static Environment parse(final String s){ if (s==null || s.isEmpty() || s.trim().isEmpty()) return GlobalEnvironment.INSTANCE; final String[] tokens = StringUtils.tokenize(s, '_'); final DynamicEnvironment env = new DynamicEnvironment(); for (final String t : tokens) { env.add(t); ...
java
{ "resource": "" }