code
stringlengths
146
466k
prompt
stringlengths
54
1.5k
Of course, here is the Java code you requested: ```java private void updateRepoInstances() { RepoInstances repoInstances = application.getRepoInstances(); RvRepoInstance rvRepoInstance = repoInstances.getRvRepoInstance(); rvRepoInstance.setDiscoveryTimout(BigInteger.valueOf(repoRvDiscoveryTimeout)); rvRepoI...
Create a Java method that does the following: "Update the repository instances.".
Of course, here is the Java code you requested: ```java private void copyRuntimeJARsInEAR(File ear) throws IOException, JDOMException { Fileset fileSet = new Fileset(); fileSet.setDirectory(buildLibDirectory.getAbsolutePath()); for (Dependency dependency : this.getJarDependencies()) { String jarName = getJar...
Create a Java method that does the following: "Copy the runtime jars in the given EAR to the buildLibDirectory.".
Of course, here is the Java code you requested: ```java public static String getRelativePath(String targetPath, String basePath, String pathSeparator) { // Normalize the paths String normalizedTargetPath = FilenameUtils.normalizeNoEndSeparator(targetPath); String normalizedBasePath = FilenameUt...
Create a Java method that does the following: "Get the relative path from the target path and base path.".
Of course, here is the Java code you requested: ```java public List<java.lang.Object> getAny() { if (any == null) { any = new ArrayList<java.lang.Object>(); } return this.any; } ``` Hope this helps!
Create a Java method that does the following: "Gets the value of the any property.".
Of course, here is the Java code you requested: ```java private PreparedStatement prepareStatement(MethodInvocation<Connection> methodInvocation) throws Throwable { String sql = methodInvocation.getArgAt(0, String.class); PreparedStatement result = (PreparedStatement) methodInvocation.proceed(); ...
Create a Java method that does the following: "Create a new PreparedStatement object from a method invocation.".
Of course, here is the Java code you requested: ```java private static <T> T newInstance(Class<T> clazz, Object... params) throws SQLException { try { if (params == null || params.length == 0) { return clazz.newInstance(); } else { for (Constructor<?> cto...
Create a Java method that does the following: "Creates a new instance of the specified class.".
Of course, here is the Java code you requested: ```java @Override public <T> T newProxy(ProxyHandler<T> proxyHandler, ProxyClass proxyClass) { return (T) Proxy.newProxyInstance(proxyClass.getClassLoader(), proxyClass.getInterfaces(), proxyHandler); } ``` Hope this helps!
Create a Java method that does the following: "Creates a new proxy instance.".
Of course, here is the Java code you requested: ```java public Timer.Context startStatementExecuteTimer(Query query) { ensureSqlId(query); String name = metricNamingStrategy.getStatementExecuteTimer(query.getSql(), query.getSqlId()); return startTimer(name); } ``` Hope this helps!
Create a Java method that does the following: "Start a Timer. Context for executing a query.".
Of course, here is the Java code you requested: ```java public Timer.Context startCallableStatementLifeTimer(Query query) { ensureSqlId(query); String name = metricNamingStrategy.getCallableStatementLifeTimer(query.getSql(), query.getSqlId()); return startTimer(name); } ``` Hope this helps...
Create a Java method that does the following: "Start a Callable Statement Life Timer".
Of course, here is the Java code you requested: ```java public Timer.Context startResultSetLifeTimer(Query query) { ensureSqlId(query); String name = metricNamingStrategy.getResultSetLifeTimer(query.getSql(), query.getSqlId()); return startTimer(name); } ``` Hope this helps!
Create a Java method that does the following: "Start a result set lifetime timer.".
Of course, here is the Java code you requested: ```java public void markResultSetRowMeter(Query query) { ensureSqlId(query); String name = metricNamingStrategy.getResultSetRowMeter(query.getSql(), query.getSqlId()); markMeter(name); } ``` Hope this helps!
Create a Java method that does the following: "Mark the result set row meter.".
Of course, here is the Java code you requested: ```java public Connection wrapConnection(Connection wrappedConnection) { Timer.Context lifeTimerContext = metricHelper.startConnectionLifeTimer(); return newProxy(new ConnectionProxyHandler(wrappedConnection, this, lifeTimerContext)); } ``` Hope t...
Create a Java method that does the following: "Wrap a connection.".
Of course, here is the Java code you requested: ```java public PreparedStatement wrapPreparedStatement(PreparedStatement preparedStatement, String sql) { Query query = new Query(sql); Timer.Context lifeTimerContext = getMetricHelper().startPreparedStatementLifeTimer(query); return newProxy(n...
Create a Java method that does the following: "Wrap a PreparedStatement.".
Of course, here is the Java code you requested: ```java private Class<? extends ResultSet> getResultSetType(ResultSet resultSet) { Class<? extends ResultSet> resultSetType; if (resultSet instanceof RowSet) { if (resultSet instanceof CachedRowSet) { if (resultSet instance...
Create a Java method that does the following: "Gets the result set type.".
Of course, here is the Java code you requested: ```java public String getResultSetLifeTimer(String sql, String sqlId) { return MetricRegistry.name(ResultSet.class, databaseName, sqlId); } ``` Hope this helps!
Create a Java method that does the following: "Gets the result set life timer.".
Of course, here is the Java code you requested: ```java @Override public String getResultSetRowMeter(String sql, String sqlId) { return MetricRegistry.name(ResultSet.class, databaseName, sqlId, "rows"); } ``` Hope this helps!
Create a Java method that does the following: "Get the result set row meter name.".
Of course, here is the Java code you requested: ```java private void buildFaceArgs(final List<String> args) { if (mode != null && CowFace.isKnownMode(mode)) { args.add(flagify(mode)); } else { if (eyes != null) { args.add(flagify(CowsayCli.Opt.EYES.toString())); args.add(eyes); } if (tongue != ...
Create a Java method that does the following: "Build the face arguments.".
Of course, here is the Java code you requested: ```java public String execute() throws IllegalStateException { validate(); String[] args = buildArgs(); String result; if (think) { result = Cowsay.think(args); } else { result = Cowsay.say(args); } return result; } ``` Hope this helps!
Create a Java method that does the following: "Execute the command.".
Of course, here is the Java code you requested: ```java public static void setLanguage(final String language) { currentLocale = new Locale(language); messages = ResourceBundle.getBundle("MessagesBundle", currentLocale); } ``` Hope this helps!
Create a Java method that does the following: "Sets the language.".
Of course, here is the Java code you requested: ```java private static String sayOrThink(final String[] args, final boolean think) { try { boolean isThought = think; String wordwrap = null; CommandLine commandLine = CowsayCli.parseCmdArgs(args); if (commandLine != null) { if (commandLine.hasOption(C...
Create a Java method that does the following: "Say or think.".
Of course, here is the Java code you requested: ```java public static void main(final String[] args) { CowsayCli.addCowthinkOption(); String cowsay = say(args); if (cowsay != null && cowsay.length() > 0) { System.out.println(cowsay); } } ``` Hope this helps!
Create a Java method that does the following: "Main method for the Cowthink CLI.".
Of course, here is the Java code you requested: ```java private static String extractCowTemplate(final String cow) throws CowParseException { Matcher matcher = COWSTART_RE.matcher(cow); if (matcher.find(0)) { String result = matcher.replaceFirst(""); return result; } else { throw new CowParseException(...
Create a Java method that does the following: "Extract the COW template from a COW string.".
Of course, here is the Java code you requested: ```java public static String load(final String cowfileSpec) { String effectiveCowfileSpec = (cowfileSpec != null) ? cowfileSpec.trim() : DEFAULT_COW; if (effectiveCowfileSpec.length() > 0) { if (!effectiveCowfileSpec.endsWith(COWFILE_EXT)) { effectiveCowfileSp...
Create a Java method that does the following: "Load the COW file from the specified string.".
Of course, here is the Java code you requested: ```java private static String cowInputStreamToString(final InputStream cowInputStream) { BufferedReader reader = new BufferedReader(new InputStreamReader(cowInputStream)); StringBuilder sb = new StringBuilder(); String line; try { String newLine = System.getPr...
Create a Java method that does the following: "Converts a COW input stream to a String.".
Of course, here is the Java code you requested: ```java private static InputStream getCowFromPath(final String path) { String cwd = System.getProperty("user.dir"); // TODO is this really CWD? if (cwd != null) { File cowfile = new File(cwd, path); if (isCowfile(cowfile)) { return cowfileToCowInputStream(...
Create a Java method that does the following: "Gets the COW file from the given path.".
Of course, here is the Java code you requested: ```java public static String[] listAllCowfiles() { String[] resultAsArray; String[] bundled = null; String cowfileExtRe = "\\" + COWFILE_EXT + "$"; InputStream bundleStream = Cowloader.class.getResourceAsStream("/cowfile-list.csv"); if (bundleStream != null) { ...
Create a Java method that does the following: "List all cowfiles.".
Of course, here is the Java code you requested: ```java private static boolean isCowfile(final File cowfile) { if (cowfile != null && cowfile.exists()) { return cowfile.getName().endsWith(COWFILE_EXT); } return false; } ``` Hope this helps!
Create a Java method that does the following: "Checks if the given file is a COW file.".
Of course, here is the Java code you requested: ```java private static File getCowfile(final String folder, final String cowName) { File[] cowfiles = getCowFiles(folder); for (File cowfile : cowfiles) { if (cowfile.getName().equals(cowName)) { return cowfile; } } return null; } ``` Hope this helps!
Create a Java method that does the following: "Gets the cowfile.".
Of course, here is the Java code you requested: ```java private static File[] getCowFiles(final String folder) { File dir = new File(folder); File[] files; files = dir.listFiles(new FilenameFilter() { @Override public boolean accept(final File dir, final String name) { return name.endsWith(".cow"); ...
Create a Java method that does the following: "Gets the cow files.".
Of course, here is the Java code you requested: ```java public final void setEyes(final String eyes) { if (eyes != null && eyes.length() > 0) { if (eyes.length() > 2) { this.eyes = eyes.substring(0, 2); } else { this.eyes = eyes; } } } ``` Hope this helps!
Create a Java method that does the following: "Sets the Eyes.".
Of course, here is the Java code you requested: ```java public final void setTongue(final String tongue) { if (tongue != null && tongue.length() > 0) { if (tongue.length() > 2) { this.tongue = tongue.substring(0, 2); } else { this.tongue = tongue; } } } ``` Hope this helps!
Create a Java method that does the following: "Sets the tongue.".
Of course, here is the Java code you requested: ```java public static final boolean isKnownMode(final String mode) { Set<String> modes = COW_MODES.keySet(); return modes.contains(mode); } ``` Hope this helps!
Create a Java method that does the following: "Checks if the given mode is known.".
Of course, here is the Java code you requested: ```java public static void showCmdLineHelp() { HelpFormatter formatter = new HelpFormatter(); updateOptionDescriptions(); formatter.printHelp(I18n.getMessage("usage"), options); } ``` Hope this helps!
Create a Java method that does the following: "Show command line help.".
Of course, here is the Java code you requested: ```java private String formatMessage(final String message) { String result; if (message != null) { result = wrapMessage(message); int longestLine = getLongestLineLen(result); if (!isThought) { result = Bubble.formatSpeech(result, longestLine); } else ...
Create a Java method that does the following: "Format the given message.".
Of course, here is the Java code you requested: ```java public void setWordwrap(final String wordwrap) { try { int ww = Integer.parseInt(wordwrap); if (ww >= 0) { this.wordwrap = ww; } } catch(Throwable ignore) { // ignore } } ``` Hope this helps!
Create a Java method that does the following: "Sets the wordwrap.".
Of course, here is the Java code you requested: ```java public void log(String message, final Callback callback) { if (message == null) return; loggly.log(token, tags, message, new retrofit2.Callback<LogglyResponse>() { @Override ...
Create a Java method that does the following: "Log a message to the loggly service.".
Of course, here is the Java code you requested: ```java public boolean logBulk(Collection<String> messages) { if (messages == null) return false; String parcel = joinStrings(messages); if (parcel.isEmpty()) return false; boolean ok; try { ok = loggly.logBulk(token,...
Create a Java method that does the following: "Logs a collection of messages to the log.".
Of course, here is the Java code you requested: ```java public SortedMap<String,Schema> getSchemas() throws SQLException { synchronized(getSchemasLock) { if(getSchemasCache==null) { SortedMap<String,Schema> newSchemas = new TreeMap<>(DatabaseMetaData.getCollator()); try (ResultSet results = metaData.getMe...
Create a Java method that does the following: "Get the list of schemas in this database.".
Of course, here is the Java code you requested: ```java public SymmetricGraph<Table,Edge<Table>,SQLException> getForeignKeyGraph(final Set<String> tableTypes) { return new SymmetricGraph<Table, Edge<Table>, SQLException>() { @Override public Set<Table> getVertices() throws SQLException { Set<Table> vertic...
Create a Java method that does the following: "Returns a SymmetricGraph of the foreign key tables.".
Of course, here is the Java code you requested: ```java @Override public void contextInitialized(ServletContextEvent sce) { try { ServletContext sc; synchronized(servletContextLock) { servletContext = sce.getServletContext(); sc = servletContext; } // Find the top level directory String gitTo...
Create a Java method that does the following: "Override contextInitialized to perform processing for the servlet context.".
Of course, here is the Java code you requested: ```java private void resync() throws IOException { Path gtl; synchronized(gitToplevelLock) { gtl = gitToplevel; } WatchService w; synchronized(watcherLock) { w = watcher; } if(gtl != null && w != null) { synchronized(registered) { Set<Path> ext...
Create a Java method that does the following: "Resync the watch.".
Of course, here is the Java code you requested: ```java public Table getTable(String name) throws NoRowException, SQLException { Table table = getTables().get(name); if(table==null) throw new NoRowException(); return table; } ``` Hope this helps!
Create a Java method that does the following: "Returns the table with the given name.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("deprecation") private static String getRow(ResultSet result) throws SQLException { StringBuilder sb = new StringBuilder(); sb.append('('); ResultSetMetaData metaData = result.getMetaData(); int colCount = metaData.getColumnCount(); f...
Create a Java method that does the following: "Get a single row of the result set.".
Of course, here is the Java code you requested: ```java public SortedMap<String,Catalog> getCatalogs() throws SQLException { synchronized(getCatalogsLock) { if(getCatalogsCache==null) { SortedMap<String,Catalog> newCatalogs = new TreeMap<>(englishCollator); try (ResultSet results = metaData.getCatalogs())...
Create a Java method that does the following: "Returns a map of catalog names to catalog objects.".
Of course, here is the Java code you requested: ```java private char[] getBuffer(int additional) throws IOException { long newLen = (long)length + additional; if(newLen > MAX_LENGTH) throw new IOException("Maximum buffer length is " + MAX_LENGTH + ", " + newLen + " requested"); char[] buf = this.buffer; int bu...
Create a Java method that does the following: "Get a buffer of the specified length.".
Of course, here is the Java code you requested: ```java private void log(Encoder encoder) throws IOException { if(encoder==null) log.write("null"); else { String className = encoder.getClass().getName(); // Some shortcuts from the ao-encoding project, classnames used here to avoid hard dependency if("com....
Create a Java method that does the following: "Write the encoder to the log.".
Of course, here is the Java code you requested: ```java private void log(Writer writer) throws IOException { if(writer==null) { log.write("null"); } else if(writer instanceof LoggingWriter) { LoggingWriter loggingWriter = (LoggingWriter)writer; log.write("writer["); log.write(Long.toString(loggingWrite...
Create a Java method that does the following: "Write the writer to the log.".
Of course, here is the Java code you requested: ```java public static <F> LexicalPosition<F> zeroWithFile( final F file) { return LexicalPosition.of(0, 0, Optional.of(file)); } ``` Hope this helps!
Create a Java method that does the following: "Returns zero with file.".
Of course, here is the Java code you requested: ```java private void append(int segmentIndex, StringBuilder buffer) { switch(segmentTypes[segmentIndex]) { case SegmentedWriter.TYPE_STRING : int off = segmentOffsets[segmentIndex]; buffer.append( (String)segmentValues[segmentIndex], off, off ...
Create a Java method that does the following: "Append the segment to the buffer.".
Of course, here is the Java code you requested: ```java private void append(int segmentIndex, int off, int len, StringBuilder buffer) { switch(segmentTypes[segmentIndex]) { case SegmentedWriter.TYPE_STRING : buffer.append( (String)segmentValues[segmentIndex], off, off + len ); break; ...
Create a Java method that does the following: "Append the segment value to the given buffer.".
Of course, here is the Java code you requested: ```java private void writeSegment(int segmentIndex, Encoder encoder, Writer out) throws IOException { switch(segmentTypes[segmentIndex]) { case SegmentedWriter.TYPE_STRING : encoder.write( (String)segmentValues[segmentIndex], segmentOffsets[segmentInde...
Create a Java method that does the following: "Writes a single segment to the given writer.".
Of course, here is the Java code you requested: ```java private Map<String,Class<?>> getSqlDataTypes() throws SQLException { if(sqlDataTypes == null) { // Load custom types from ServiceLoader Map<String,Class<?>> newMap = new LinkedHashMap<>(); Iterator<SQLData> iter = ServiceLoader.load(SQLData.class).iter...
Create a Java method that does the following: "Get the SQL data types.".
Of course, here is the Java code you requested: ```java @Override public T createObject(ResultSet result) throws SQLException { try { ResultSetMetaData metaData = result.getMetaData(); int numColumns = metaData.getColumnCount(); int numParams = prefixParams.length + numColumns; Object[] params = new Obj...
Create a Java method that does the following: "Create an object from a result set.".
Of course, here is the Java code you requested: ```java public Column getColumn(int ordinalPosition) throws NoRowException, SQLException { try { return getColumns().get(ordinalPosition-1); } catch(IndexOutOfBoundsException exc) { throw new NoRowException(exc); } } ``` Hope this helps!
Create a Java method that does the following: "Gets the column at the given position.".
Of course, here is the Java code you requested: ```java public Index getPrimaryKey() throws SQLException { synchronized(getPrimaryKeyLock) { if(!getPrimaryKeyCached) { String pkName = null; List<Column> columns = new AutoGrowArrayList<>(); try (ResultSet results = schema.getCatalog().getMetaData().get...
Create a Java method that does the following: "Gets the primary key.".
Of course, here is the Java code you requested: ```java private void addSegment(byte type, Object value, int off, int len) { assert !isClosed; assert len>0 : "Empty segments should never be added"; final int arraylen = segmentValues.length; if(segmentCount==arraylen) { // Need to grow if(arraylen==0) { ...
Create a Java method that does the following: "Add a segment to the internal array.".
Of course, here is the Java code you requested: ```java private void log(char ch) throws IOException { if(ch=='\t') log.write("'\\t'"); else if(ch=='\b') log.write("'\\b'"); else if(ch=='\n') log.write("'\\n'"); else if(ch=='\r') log.write("'\\r'"); else if(ch=='\f') log.write("'\\f'"); else if(ch=='\'') l...
Create a Java method that does the following: "Write a character to the log.".
Of course, here is the Java code you requested: ```java public static ContentValues acquire() { ContentValues vals = sPool.acquire(); return vals != null ? vals : new ContentValues(); } ``` Hope this helps!
Create a Java method that does the following: "Get a resource from the pool.".
Of course, here is the Java code you requested: ```java public static ContentValues putAll(ContentValues target, Object... values) { int length = values.length; checkArgument(length % 2 == 0, "values length must be a multiple of two"); for (int i = 0; i < length; i += 2) { String ke...
Create a Java method that does the following: "Put all the content values in the array into the target ContentValues object.".
Of course, here is the Java code you requested: ```java public void onBind(B binding, E item, int position, List<Object> payloads) { onBind(binding, item, position); } ``` Hope this helps!
Create a Java method that does the following: "Called when a binding is being made.".
Of course, here is the Java code you requested: ```java public static Uri appendId(Uri uri, Cursor cursor) { return ContentUris.withAppendedId(uri, cursor.getLong(cursor.getColumnIndexOrThrow(_ID))); } ``` Hope this helps!
Create a Java method that does the following: "Append the id to the uri.".
Of course, here is the Java code you requested: ```java public static Uri groupBy(Uri uri, String groupBy) { return groupByHavingLimit(uri, groupBy, null, null); } ``` Hope this helps!
Create a Java method that does the following: "Group by.".
Of course, here is the Java code you requested: ```java public static Uri limit(Uri uri, int limit) { return limit(uri, String.valueOf(limit)); } ``` Hope this helps!
Create a Java method that does the following: "Limit the URI to the given limit.".
Of course, here is the Java code you requested: ```java public static Uri limit(Uri uri, String limit) { return groupByHavingLimit(uri, null, null, limit); } ``` Hope this helps!
Create a Java method that does the following: "Limit the URIs to a given number of characters.".
Of course, here is the Java code you requested: ```java public static Uri notifyChange(Uri uri, long id, boolean notify) { Builder builder = uri.buildUpon(); if (id > 0) { ContentUris.appendId(builder, id); } return builder.appendQueryParameter(NOTIFY_CHANGE, notify ? "1" : ...
Create a Java method that does the following: "Notify the user about a change of a resource.".
Of course, here is the Java code you requested: ```java static void init(Context context) { Context app = context.getApplicationContext(); sProvider = DoubleCheck.provider( () -> (app.getApplicationInfo().flags & FLAG_DEBUGGABLE) == FLAG_DEBUGGABLE ? DaggerSprock...
Create a Java method that does the following: "Initialize the application.".
Of course, here is the Java code you requested: ```java public static ProgressBarFragment newInstance(@AttrRes int style) { ProgressBarFragment frag = new ProgressBarFragment(); Bundle args = Fragments.arguments(frag); args.putInt(STYLE, style); return frag; } ``` Hope this helps!
Create a Java method that does the following: "Create a new instance of the class based on the attribute resource and style.".
Of course, here is the Java code you requested: ```java @UiThread public static void tryDelayed(ViewGroup sceneRoot) { if (!sceneRoot.isLaidOut()) { // transition won't run return; } if (sDelayedTransition == null) { sDelayedTransition = new AutoTransition().addListe...
Create a Java method that does the following: "Try to run a delayed transition.".
Of course, here is the Java code you requested: ```java public static StyleSpan bold(int i) { if (sBolds == null) { sBolds = new ArrayList<>(); sBolds.add(bold()); } if (i < sBolds.size()) { return sBolds.get(i); } else { StyleSpan bold = ...
Create a Java method that does the following: "Get a bold style span.".
Of course, here is the Java code you requested: ```java public static ForegroundColorSpan foregroundColor(@ColorInt int color, int i) { if (sForeColors == null) { sForeColors = new SparseArray<>(); } List<ForegroundColorSpan> spans = sForeColors.get(color); if (spans == null...
Create a Java method that does the following: "Get a ForegroundColorSpan from a color and an index.".
Of course, here is the Java code you requested: ```java public static ViewPropertyAnimator scaleIn(View view) { return scale(view, 1.0f, enterScreen(), R.integer.anim_duration_enter); } ``` Hope this helps!
Create a Java method that does the following: "Scale the view in screen.".
Of course, here is the Java code you requested: ```java public static ViewPropertyAnimator scaleOut(View view) { return scale(view, 0.0f, exitScreen(), R.integer.anim_duration_exit); } ``` Hope this helps!
Create a Java method that does the following: "Scale the view to be out of screen.".
Of course, here is the Java code you requested: ```java public static ViewPropertyAnimator scaleSwap(ImageView image, @DrawableRes int drawableId) { return scaleSwap(image, drawableId, null); } ``` Hope this helps!
Create a Java method that does the following: "Scale the image view to a specific drawable.".
Of course, here is the Java code you requested: ```java public static ViewPropertyAnimator scaleSwap(ImageView image, @DrawableRes int drawableId, Runnable endAction) { return scale(image, () -> image.setImageResource(drawableId), endAction); } ``` Hope thi...
Create a Java method that does the following: "Scale the image view to a given drawable.".
Of course, here is the Java code you requested: ```java public static ViewPropertyAnimator makeScaleDownAnimation(Activity a, Rect to) { View view = a.getWindow().getDecorView(); Rect frame = Windows.getFrame(a); float sx = (float) to.width() / view.getWidth(); float sy = (float) to.hei...
Create a Java method that does the following: "Creates an animation which scales the view down from the left to the top of the activity.".
Of course, here is the Java code you requested: ```java public static int getCount(Context context, Uri uri) { String[] proj = {"COUNT(*)"}; return Cursors.firstInt(context.getContentResolver().query(uri, proj, null, null, null)); } ``` Hope this helps!
Create a Java method that does the following: "Get count from uri.".
Of course, here is the Java code you requested: ```java public static void requestSyncNow(Account account, String authority, @Nullable Bundle extras) { if (extras == null) { extras = new Bundle(); } extras.putBoolean(SYNC_EXTRAS_MANUAL, true); extras.putBoolean(SYNC_EXTRAS_E...
Create a Java method that does the following: "Request the content of the authority with the specified account and authority name.".
Of course, here is the Java code you requested: ```java public static String concatAddressLines(Address address, String delimiter) { StringBuilder s = new StringBuilder(256); for (int i = 0, max = address.getMaxAddressLineIndex(); i <= max; i++) { if (i > 0) { s.append(delim...
Create a Java method that does the following: "concatAddressLines This method is used to concatenate the address lines of a single address.".
Of course, here is the Java code you requested: ```java public static GoogleApiClient connect(GoogleApiClient client, ConnectedListener connected, OnConnectionFailedListener failed) { client.registerConnectionCallbacks(new ConnectionListener(connected)); client...
Create a Java method that does the following: "Connect to the Google API server.".
Of course, here is the Java code you requested: ```java public static Bundle arguments(Fragment frag) { Bundle args = frag.getArguments(); if (args == null) { if (!frag.isAdded()) { args = new Bundle(); try { frag.setArguments(args); ...
Create a Java method that does the following: "Get the arguments for a fragment.".
Of course, here is the Java code you requested: ```java @SuppressLint("CommitTransaction") private static FragmentTransaction transit(FragmentManager fm, int transit) { return fm != null ? fm.beginTransaction().setTransition(transit) : null; } ``` Hope this helps!
Create a Java method that does the following: "Creates a transaction with a given transition.".
Of course, here is the Java code you requested: ```java @Nullable public static <T extends Fragment> T findById(Activity a, @IdRes int id) { return findById(a.getFragmentManager(), id); } ``` Hope this helps!
Create a Java method that does the following: "Find a fragment by id.".
Of course, here is the Java code you requested: ```java public static <T extends View> T visible(@Nullable T view) { return set(view, VISIBLE); } ``` Hope this helps!
Create a Java method that does the following: "Sets the view to be visible.".
Of course, here is the Java code you requested: ```java public static <T extends View> T invisible(@Nullable T view) { return set(view, INVISIBLE); } ``` Hope this helps!
Create a Java method that does the following: "Sets the view to invisible.".
Of course, here is the Java code you requested: ```java public static <T extends View> T measure(T view, ViewGroup parent) { LayoutParams p = view.getLayoutParams(); int w = parent != null && p.width == MATCH_PARENT ? parent.getMeasuredWidth() : p.width; int h = parent != null && p.height == MA...
Create a Java method that does the following: "Measure the view using the layout params of the parent view.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") public static <T extends View> T inflate(ViewStub stub, @Nullable T view) { return view == null ? (T) stub.inflate() : view; } ``` Hope this helps!
Create a Java method that does the following: "Inflate a view using a view stub.".
Of course, here is the Java code you requested: ```java public void e(Object src, String msg, @Nullable Throwable thrown) { maybeLog(ERROR, src, msg, thrown); } ``` Hope this helps!
Create a Java method that does the following: "Logs an ERROR exception.".
Of course, here is the Java code you requested: ```java public static ActivityOptions makeScaleUpAnimation(View source) { return ActivityOptions.makeScaleUpAnimation( source, 0, 0, source.getWidth(), source.getHeight()); } ``` Hope this helps!
Create a Java method that does the following: "Make a scale up animation for a view.".
Of course, here is the Java code you requested: ```java public static void hide(View view) { Managers.inputMethod(view.getContext()).hideSoftInputFromWindow(view.getWindowToken(), 0); } ``` Hope this helps!
Create a Java method that does the following: "Hide the view.".
Of course, here is the Java code you requested: ```java public static boolean hasPosition(Cursor cursor, int position) { return !cursor.isClosed() && position >= 0 && position < cursor.getCount(); } ``` Hope this helps!
Create a Java method that does the following: "Returns true if the cursor has the given position.".
Of course, here is the Java code you requested: ```java public static int count(Cursor cursor, boolean close) { int count = cursor.getCount(); close(cursor, close); return count; } ``` Hope this helps!
Create a Java method that does the following: "Count the number of records in the cursor.".
Of course, here is the Java code you requested: ```java public static int firstInt(Cursor cursor, boolean close) { int i = cursor.moveToFirst() ? cursor.getInt(0) : Integer.MIN_VALUE; close(cursor, close); return i; } ``` Hope this helps!
Create a Java method that does the following: "Get the first int value from the cursor.".
Of course, here is the Java code you requested: ```java public static long firstLong(Cursor cursor, boolean close) { long l = cursor.moveToFirst() ? cursor.getLong(0) : Long.MIN_VALUE; close(cursor, close); return l; } ``` Hope this helps!
Create a Java method that does the following: "Get the first long value from the cursor.".
Of course, here is the Java code you requested: ```java @Nullable public static String firstString(Cursor cursor, boolean close) { String s = cursor.moveToFirst() ? cursor.getString(0) : null; close(cursor, close); return s; } ``` Hope this helps!
Create a Java method that does the following: "Get the first string from the cursor.".
Of course, here is the Java code you requested: ```java public static int[] allInts(Cursor cursor, boolean close) { int[] i = EMPTY_INT_ARRAY; if (cursor.moveToFirst()) { i = new int[cursor.getCount()]; do { i[cursor.getPosition()] = cursor.getInt(0); ...
Create a Java method that does the following: "Get all ints from cursor.".
Of course, here is the Java code you requested: ```java public static String[] allStrings(Cursor cursor, boolean close) { String[] s = EMPTY_STRING_ARRAY; if (cursor.moveToFirst()) { s = new String[cursor.getCount()]; do { s[cursor.getPosition()] = cursor.getStri...
Create a Java method that does the following: "Get all Strings from a Cursor.".
Of course, here is the Java code you requested: ```java @BindingAdapter(value = {"sprockets_placeholder", "sprockets_load", "sprockets_resize", "sprockets_transform"}, requireAll = false) public static void load(ImageView view, Drawable placeholder, Uri load, boolean resize, ...
Create a Java method that does the following: "Load image from image view.".
Of course, here is the Java code you requested: ```java public static int getSpanCount(RecyclerView view) { LayoutManager layout = view.getLayoutManager(); if (layout != null) { if (layout instanceof GridLayoutManager) { return ((GridLayoutManager) layout).getSpanCount(); ...
Create a Java method that does the following: "Get the span count of a RecyclerView.".
Of course, here is the Java code you requested: ```java public static SpanSizeLookup getSpanSizeLookup(RecyclerView view) { LayoutManager layout = view.getLayoutManager(); if (layout instanceof GridLayoutManager) { return ((GridLayoutManager) layout).getSpanSizeLookup(); } i...
Create a Java method that does the following: "Get the SpanSizeLookup object for a RecyclerView.".
Of course, here is the Java code you requested: ```java public static SearchView setBackground(SearchView view, @DrawableRes int drawableId) { int id = view.getResources().getIdentifier("android:id/search_plate", null, null); if (id > 0) { View search = view.findViewById(id); if...
Create a Java method that does the following: "setBackground Method.".