code stringlengths 160 48.7k | prompt stringlengths 55 1.51k |
|---|---|
Of course, here is the Java code you requested:
```java
public static Object fromJsonParser(JsonParser jp) throws IOException {
Object rval;
final JsonToken initialToken = jp.nextToken();
if (initialToken == JsonToken.START_ARRAY) {
rval = jp.readValueAs(List.class);
} else... | Create a Java method that does the following: "Deserialize a JsonParser object into a class.". |
Of course, here is the Java code you requested:
```java
public static Object[] toArray(Object obj, int objType) {
Object[] values;
switch (objType) {
case ZealotConst.OBJTYPE_ARRAY:
values = (Object[]) obj;
break;
case ZealotConst.OBJTYPE_COLLECTI... | Create a Java method that does the following: "This method returns an array of the type of the object.". |
Of course, here is the Java code you requested:
```java
public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException {
if (str.equals("{"))
str = addMatchingBrace(offset);
super.insertString(offset, str, a);
processChangedLines(offset, str.length())... | Create a Java method that does the following: "Insert a string into the attribute set.". |
Of course, here is the Java code you requested:
```java
@Override
public GetUserAttributeVerificationCodeResult getUserAttributeVerificationCode(GetUserAttributeVerificationCodeRequest request) {
request = beforeClientExecution(request);
return executeGetUserAttributeVerificationCode(request);
... | Create a Java method that does the following: "Retrieves the verification code for a user attribute.". |
Of course, here is the Java code you requested:
```java
public final boolean append(String key, final Object value, final long timeout)
throws TimeoutException, InterruptedException, MemcachedException {
key = this.preProcessKey(key);
byte[] keyBytes = this.checkStoreArguments(key, 0, value);
return ... | Create a Java method that does the following: "Append a value to the cache.". |
Of course, here is the Java code you requested:
```java
@RequestMapping(path = "", method = RequestMethod.GET)
public Page<Customer> getCustomers(Pageable pageable){
return customerService.getCustomers(pageable);
}
```
Hope this helps! | Create a Java method that does the following: "Get a list of all customers.". |
Of course, here is the Java code you requested:
```java
public static BufferedImage getUrlBufferedImage(String urlPath) {
URL url = null;
BufferedImage bufferImage = null;
try {
url = new URL(urlPath);
bufferImage = ImageIO.read(url);
return bufferImage;
} catch (Exception e) {
logger.error("getUrl... | Create a Java method that does the following: "Get a BufferedImage from a URL". |
Of course, here is the Java code you requested:
```java
private void adaptMessage() {
if (messageTextView != null) {
messageTextView.setText(message);
messageTextView.setVisibility(!TextUtils.isEmpty(message) ? View.VISIBLE : View.GONE);
}
adaptMessageContainerVisibilit... | Create a Java method that does the following: "Adapts the message.". |
Of course, here is the Java code you requested:
```java
protected void registerLdapComponent() {
String componentPropName = GatewayConfigProperties.COMPONENT_PREFIX + ILdapComponent.class.getSimpleName();
setConfigProperty(componentPropName, DefaultLdapComponent.class.getName());
}
```
Hope this h... | Create a Java method that does the following: "Register the LDAP component.". |
Of course, here is the Java code you requested:
```java
@Override
public MarginalSet computeMarginals(FactorGraph factorGraph) {
VariableNumMap variables = factorGraph.getVariables();
Preconditions.checkArgument(variables.getDiscreteVariables().size() == variables.size());
// Initialize the mean field d... | Create a Java method that does the following: "Compute the MarginalSet for a given factor graph.". |
Of course, here is the Java code you requested:
```java
public int getSize(Row row) {
Object[] data = row.getData();
Type[] types = row.getTable().getColumnTypes();
int cols = row.getTable().getDataColumnCount();
return INT_STORE_SIZE + getSize(data, cols, types);
}
```
... | Create a Java method that does the following: "Get the size of a row.". |
Of course, here is the Java code you requested:
```java
@Override
public void reportRepeatedMessages(String sourceMEUuid, int percent)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reportRepeatedMessages", new Object[] { sourceMEUuid, new Integer(percen... | Create a Java method that does the following: "Report repeated messages.". |
Of course, here is the Java code you requested:
```java
public static void assertOnlyOneMethod(final Collection<Method> methods, Class<? extends Annotation> annotation)
{
if (methods.size() > 1)
{
throw annotation == null ? MESSAGES.onlyOneMethodCanExist() : MESSAGES.onlyOneMethodCanExist2(anno... | Create a Java method that does the following: "Assert only one method.". |
Of course, here is the Java code you requested:
```java
@Override
public InetSocketAddress get(final Identifier key,
final Callable<InetSocketAddress> valueFetcher) throws ExecutionException {
return cache.get(key, valueFetcher);
}
```
Hope this helps! | Create a Java method that does the following: "Get an address from the cache.". |
Of course, here is the Java code you requested:
```java
public void marshall(NonCompliantSummary nonCompliantSummary, ProtocolMarshaller protocolMarshaller) {
if (nonCompliantSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
... | Create a Java method that does the following: "marshalls the given NonCompliantSummary to the given protocolMarshaller.". |
Of course, here is the Java code you requested:
```java
private void renameFile(File source, File target) {
if (!source.exists()) {
// don't do anything if the source file doesn't exist
return;
}
if (target.exists()) {
target.delete();
}
boole... | Create a Java method that does the following: "Renames the source file to the target file.". |
Of course, here is the Java code you requested:
```java
public int getInt(String pName, int defaultValue) {
String pValue = _properties.getProperty(pName);
return parseInt(pName, pValue, defaultValue);
}
```
Hope this helps! | Create a Java method that does the following: "Gets an int value from a property.". |
Of course, here is the Java code you requested:
```java
public Duration divide(long amount) {
return new Divide().apply(this, unit == null ? FOREVER : new Duration(amount, unit));
}
```
Hope this helps! | Create a Java method that does the following: "Divide this duration by the given amount.". |
Of course, here is the Java code you requested:
```java
public static Optional<String> getElementAttributeString(final String aElementSelector,
final String aAttributeKey, final Document aDocument) {
final Elements selected = aDocument.select(aElementSelector);
if (!selected.isEmpty() && selected.first()... | Create a Java method that does the following: "Get the element attribute string.". |
Of course, here is the Java code you requested:
```java
public int getWidthWeight()
{
int ret = 1;
if (!isFixedWidth() && hasProperty(UIFormFieldProperty.WIDTH)) {
ret = Integer.valueOf(getProperty(UIFormFieldProperty.WIDTH));
}
return ret;
}
```
Hope this helps! | Create a Java method that does the following: "Gets the width weight.". |
Of course, here is the Java code you requested:
```java
public static boolean getBoolean(JSONValue value) {
if (value == null)
return false;
if (!(value instanceof JSONBoolean))
throw new JSONException(NOT_A_BOOLEAN);
return ((JSONBoolean)value).booleanValue();
... | Create a Java method that does the following: "Get the boolean value from a JSONValue object.". |
Of course, here is the Java code you requested:
```java
public String matchRequestKey(CmsFlexRequestKey key) {
StringBuffer str = new StringBuffer(100);
if (m_always < 0) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHEKEY_KEYMAT... | Create a Java method that does the following: "Checks if the request key matches the cache key.". |
Of course, here is the Java code you requested:
```java
public double getFitness(List<ColouredPolygon> candidate,
List<? extends List<ColouredPolygon>> population)
{
// Use one renderer per thread because they are not thread safe.
Renderer<List<ColouredPolygon>, Buffere... | Create a Java method that does the following: "Get the fitness of a polygon in a population.". |
Of course, here is the Java code you requested:
```java
public String getFullyQualifiedMethodName() {
if (!visitingMethod) {
throw new IllegalStateException("getFullyQualifiedMethodName called while not visiting method");
}
if (fullyQualifiedMethodName == null) {
getMeth... | Create a Java method that does the following: "Get the full qualified name of the method.". |
Of course, here is the Java code you requested:
```java
static HttpRequestBase createHttpRequest(
Request<?> request, Map<String, String> additionalHeaders) {
switch (request.getMethod()) {
case Request.Method.GET:
return new HttpGet(request.getUrlString());
... | Create a Java method that does the following: "Creates an HttpRequestBase based on the given request.". |
Of course, here is the Java code you requested:
```java
public final void setConfigFile(@Nonnull final String pConfigFile)
{
mdlConfigCallable = new CallableNoEx<MdlConfig>()
{
@Override
@Nonnull
public MdlConfig call()
{
MdlConfig res... | Create a Java method that does the following: "Set the config file.". |
Of course, here is the Java code you requested:
```java
public Iterator<Node> getVersions(final Graph graph,
final Node subject) {
// Mementos should be ordered by date so use the getOrderedVersions.
return getOrderedVersions(graph, subject, CONTAINS.asResource());
}
```
Hope this helps! | Create a Java method that does the following: "Get the versions of a node.". |
Of course, here is the Java code you requested:
```java
public int setCalendar(Calendar value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
java.util.Date dateTemp = value.getTime();
int errorCode = this.setData(dateTemp, bDisplayOption, iMoveMode);
return er... | Create a Java method that does the following: "Set the value of the calendar field.". |
Of course, here is the Java code you requested:
```java
protected void stacktrace(Throwable e, boolean always) {
if (debug || always) {
println(">>> stacktrace:");
if (output instanceof PrintStream) {
e.printStackTrace((PrintStream) output);
} else {
... | Create a Java method that does the following: "Print stack trace.". |
Of course, here is the Java code you requested:
```java
public static <T0, T1, T2, T3, T4, T5> Tuple6<T0, T1, T2, T3, T4, T5> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) {
return new Tuple6<>(value0,
value1,
value2,
value3,
value4,
value5);
}
```
Hope this helps! | Create a Java method that does the following: "Construct a tuple with the specified values.". |
Of course, here is the Java code you requested:
```java
public void maybeAddLatency(IAsyncCallback cb, InetAddress address, long latency)
{
if (cb.isLatencyForSnitch())
addLatency(address, latency);
}
```
Hope this helps! | Create a Java method that does the following: "Add latency for SNitch.". |
Of course, here is the Java code you requested:
```java
protected void makeCoordinateAxes(NetcdfDataset ncDataset) {
for (VarProcess vp : varList) {
if (vp.isCoordinateAxis || vp.isCoordinateVariable) {
if (vp.axisType == null)
vp.axisType = getAxisType(ncDataset, (VariableEnhanced) vp.... | Create a Java method that does the following: "Make the coordinate axes for the variables in the dataset.". |
Of course, here is the Java code you requested:
```java
private String[] parseArgLine( final String toProcess )
{
if ( toProcess == null || toProcess.length() == 0 )
{
// no command? no string
return new String[0];
}
// parse with a simple finite state machi... | Create a Java method that does the following: "Parses a string containing a single line of a CRA - A language command.". |
Of course, here is the Java code you requested:
```java
@Override
protected MAPDialogImpl createNewDialogIncoming(MAPApplicationContext appCntx, Dialog tcapDialog) {
return new MAPDialogLsmImpl(appCntx, tcapDialog, this.mapProviderImpl, this, null, null);
}
```
Hope this helps! | Create a Java method that does the following: "Create a new MAPDialogImpl that is a new MAPDialogImpl that is a MAPDialogImpl that is a MAPDialogLsmImpl.". |
Of course, here is the Java code you requested:
```java
public void verify() throws Exception {
Map<String, ProxyPolicyHandler> handlers = null;
if (proxyCertInfo != null) {
String oid = proxyCertInfo.getProxyPolicy().getPolicyLanguage().getId();
handlers = new HashMap<String,P... | Create a Java method that does the following: "Verify the proxy certificate.". |
Of course, here is the Java code you requested:
```java
public String getInitialTransport() {
if(getTransaction() != null) {
return ((SIPTransaction)getTransaction()).getTransport();
} else {
ViaHeader via = (ViaHeader) message.getHeader(ViaHeader.NAME);
if(via == null ||
// https://github.com/Mobice... | Create a Java method that does the following: "Gets the initial transport.". |
Of course, here is the Java code you requested:
```java
public static Matcher<PrintableResult> hasFailureContaining(final String string) {
return new TypeSafeMatcher<PrintableResult>() {
@Override
public boolean matchesSafely(PrintableResult item) {
return item.failureCo... | Create a Java method that does the following: "Matches a result that contains a failure containing a given string.". |
Of course, here is the Java code you requested:
```java
public static void copyChildrenRecursive(VirtualFile original, VirtualFile target) throws IOException {
if (original == null) {
throw MESSAGES.nullArgument("Original VirtualFile");
}
if (target == null) {
throw MESS... | Create a Java method that does the following: "Copy children recursively.". |
Of course, here is the Java code you requested:
```java
IAtom toCDKAtom(Atom beamAtom, int hCount) {
IAtom cdkAtom = newCDKAtom(beamAtom);
cdkAtom.setImplicitHydrogenCount(hCount);
cdkAtom.setFormalCharge(beamAtom.charge());
if (beamAtom.isotope() >= 0) cdkAtom.setMassNumber(beamAtom... | Create a Java method that does the following: "Converts a beam atom to a CDK atom.". |
Of course, here is the Java code you requested:
```java
public static void getSharesByUser (Activity context, User user, int start, int end, ShareListListener listener) {
proxy.getSharesByUser(context, user, start, end, listener);
}
```
Hope this helps! | Create a Java method that does the following: "Get a list of shares for a user.". |
Of course, here is the Java code you requested:
```java
private TableAlias createTableAlias(String table, String path)
{
TableAlias alias;
if (table == null)
{
getLogger().warn("Creating TableAlias without table for path: " + path);
}
String aliasName ... | Create a Java method that does the following: "Create a TableAlias for a single path.". |
Of course, here is the Java code you requested:
```java
protected void addUser(UaaUser user) {
ScimUser scimUser = getScimUser(user);
if (scimUser==null) {
if (isEmpty(user.getPassword()) && user.getOrigin().equals(OriginKeys.UAA)) {
logger.debug("User's password cannot be e... | Create a Java method that does the following: "Add a user to the session.". |
Of course, here is the Java code you requested:
```java
@Override
public void write(final DataOutput out) throws IOException {
out.writeInt(this.map.size());
for (final Entry<K, V> entry : this.map.entrySet()) {
entry.getKey().write(out);
entry.getValue().write(out);
}
}
```
Hope this helps! | Create a Java method that does the following: "Write the map to the output.". |
Of course, here is the Java code you requested:
```java
private void setRestrictedAttributes(Map<String, String> attributes) {
// Translate disabled attribute
getModel().setDisabled("true".equals(attributes.get(DISABLED_ATTRIBUTE_NAME)));
}
```
Hope this helps! | Create a Java method that does the following: "Sets the restricted attributes.". |
Of course, here is the Java code you requested:
```java
protected void visitSetTraceObjectField() {
visitFieldInsn(
PUTSTATIC,
classAdapter.getClassInternalName(),
classAdapter.getTraceObjectFieldName(),
classAdapter.ge... | Create a Java method that does the following: "Visit a SETSTATIC field of the trace object.". |
Of course, here is the Java code you requested:
```java
@Override
@SuppressWarnings("unchecked")
public T fromString(final String rawValue) { // NOSONAR
try {
Object result = null;
if (byte.class.equals(this.valueClass)) {
result = Byte.decode(rawValue);
} else if (short.class.equals(this.valueClass))... | Create a Java method that does the following: "Converts the given raw value to the appropriate value class.". |
Of course, here is the Java code you requested:
```java
public CorporationStarbaseResponse getCorporationsCorporationIdStarbasesStarbaseId(Integer corporationId,
Long starbaseId, Integer systemId, String datasource, String ifNoneMatch, String token) throws ApiException {
ApiResponse<CorporationStar... | Create a Java method that does the following: "Get Corporation Starbases ID Get Corporation Starbases ID". |
Of course, here is the Java code you requested:
```java
public Lock acquirePutFromLoadLock(Object session, Object key, long txTimestamp) {
if (trace) {
log.tracef("acquirePutFromLoadLock(%s#%s, %d)", cache.getName(), key, txTimestamp);
}
boolean locked = false;
PendingPutMap pending = pendingPuts.get( key ... | Create a Java method that does the following: "Acquires a lock on the specified key from the load lock.". |
Of course, here is the Java code you requested:
```java
public void registerNotificationSource(final NotificationSource src) {
if (!this.tracerStorage.containsKey(src)) {
TracerStorage ts = new TracerStorage(src, this);
this.tracerStorage.put(src, ts);
}
}
```
Hope this helps! | Create a Java method that does the following: "Register a notification source.". |
Of course, here is the Java code you requested:
```java
public URI getStandardUri() {
try {
Catalog cat = dataset.getParentCatalog();
if (cat == null)
return new URI(getUnresolvedUrlName());
return cat.resolveUri(getUnresolvedUrlName());
} catch (java.net.URISyntaxException e) {
... | Create a Java method that does the following: "Get the standard URI for this URL.". |
Of course, here is the Java code you requested:
```java
public Matrix4d arcball(double radius, double centerX, double centerY, double centerZ, double angleX, double angleY, Matrix4d dest) {
double m30 = m20 * -radius + this.m30;
double m31 = m21 * -radius + this.m31;
double m32 = m22 * -radius ... | Create a Java method that does the following: "Compute the ARCBALL transformation of this matrix.". |
Of course, here is the Java code you requested:
```java
public void writeOne(String path){
File f = new File(path);
if(!f.getParentFile().exists()){
f.getParentFile().mkdirs();
}
Writer out = null;
try {
out = new OutputStreamWriter(new FileOutputStream(path),"utf8");
Iterator<FNLPDoc>... | Create a Java method that does the following: "Write one file to the file system.". |
Of course, here is the Java code you requested:
```java
@CheckReturnValue
@BackpressureSupport(BackpressureKind.ERROR)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> onBackpressureBuffer(int capacity) {
return onBackpressureBuffer(capacity, false, false);
}
```
Hope this hel... | Create a Java method that does the following: "On backpressure buffer.". |
Of course, here is the Java code you requested:
```java
public static Expression ifInf(Expression expression1, Expression expression2, Expression... others) {
return build("IFINF", expression1, expression2, others);
}
```
Hope this helps! | Create a Java method that does the following: "Returned expression results in a if - inf result.". |
Of course, here is the Java code you requested:
```java
private static Map<Long, Double> fillCalculateMetricTransform(Metric metric, String calculationType) {
// Calculate min, max, avg, dev, or a percentile value
Double result = calculateResult(metric, calculationType);
// return a new time s... | Create a Java method that does the following: "Fill the calculate metric transform map.". |
Of course, here is the Java code you requested:
```java
public static void validateConfiguration(Configuration conf) throws IOException {
// Ensure the BigQuery output information is valid.
ConfigurationUtil.getMandatoryConfig(conf, REQUIRED_KEYS);
// Run through the individual getters as they manage erro... | Create a Java method that does the following: "Validate the configuration.". |
Of course, here is the Java code you requested:
```java
public void setSelectedDate(int year, int month, int day) {
dateSpinner.setSelectedDate(new GregorianCalendar(year, month, day));
// a custom selection has been set, don't select the default date:
shouldSelectDefault = false;
}
```
Ho... | Create a Java method that does the following: "Sets the selected date.". |
Of course, here is the Java code you requested:
```java
public static boolean isWebJar(File file) {
Set<String> found = new LinkedHashSet<>();
if (file.isFile() && file.getName().endsWith(".jar")) {
JarFile jar = null;
try {
jar = new JarFile(file);
... | Create a Java method that does the following: "Checks if the file is a webjar.". |
Of course, here is the Java code you requested:
```java
public static <T> T get(Class<T> clazz, String sql, Object... arg) {
List<T> list = DBUtils.getList(clazz, sql, arg);
if (list.isEmpty()) {
return null;
}
return list.get(0);
}
```
Hope this helps! | Create a Java method that does the following: "Get a single record from the database.". |
Of course, here is the Java code you requested:
```java
public static Object put(String key, Object value) {
return value == null ? CONTEXT.remove(key) : CONTEXT.put(key, value);
}
```
Hope this helps! | Create a Java method that does the following: "Put a value into the context.". |
Of course, here is the Java code you requested:
```java
@NullableDecl
Map<K, V> loadAll(Set<? extends K> keys, CacheLoader<? super K, V> loader)
throws ExecutionException {
checkNotNull(loader);
checkNotNull(keys);
Stopwatch stopwatch = Stopwatch.createStarted();
Map<K, V> result;
boolean s... | Create a Java method that does the following: "Load all the entries from the cache loader.". |
Of course, here is the Java code you requested:
```java
private final boolean isConsonant(int i) {
switch (b[i]) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return false;
case 'y':
return (i == 0) ? ... | Create a Java method that does the following: "isConsonant returns true if i is a consonant.". |
Of course, here is the Java code you requested:
```java
public void setMailFromDefault(String sender) {
m_mailFromDefault = sender;
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_DEFAULT_SENDER_1, m_mailFromDefault));
}
}
```
Ho... | Create a Java method that does the following: "Sets the mailFromDefault property.". |
Of course, here is the Java code you requested:
```java
public File getAbsolutePath(String filename)
{
if (pathenv == null || pathSep == null || fileSep == null)
{
return null;
}
int val = -1;
String classvalue = pathenv + pathSep;
while (((val = classvalue.indexOf(pathSe... | Create a Java method that does the following: "Gets the absolute path of the file.". |
Of course, here is the Java code you requested:
```java
public Observable<DetectorResponseInner> getSiteDetectorResponseAsync(String resourceGroupName, String siteName, String detectorName) {
return getSiteDetectorResponseWithServiceResponseAsync(resourceGroupName, siteName, detectorName).map(new Func1<Service... | Create a Java method that does the following: "Gets the result of a GetSiteDetectorResponse operation.". |
Of course, here is the Java code you requested:
```java
public void init(Long channelId) {
String path = ManagePathUtils.getChannelByChannelId(channelId);
byte[] data = JsonUtils.marshalToByte(ChannelStatus.STOP);// 初始化的数据对象
try {
zookeeper.create(path, data, CreateMode.PERSISTENT)... | Create a Java method that does the following: "Init the channel.". |
Of course, here is the Java code you requested:
```java
public void setConfigurationTemplates(java.util.Collection<String> configurationTemplates) {
if (configurationTemplates == null) {
this.configurationTemplates = null;
return;
}
this.configurationTemplates = new com... | Create a Java method that does the following: "Sets the value configurationTemplates property.". |
Of course, here is the Java code you requested:
```java
public int getIntegerPropertyFallback(T property) throws NumberFormatException
{
try
{
return getIntegerProperty(property);
}
catch (NumberFormatException e)
{
return Integer.parseInt(get... | Create a Java method that does the following: "Gets the integer property fallback.". |
Of course, here is the Java code you requested:
```java
@SafeVarargs
public static <T> LinkedList<T> newLinkedList(T... values) {
return (LinkedList<T>) list(true, values);
}
```
Hope this helps! | Create a Java method that does the following: "Creates a new LinkedList backed by the specified values.". |
Of course, here is the Java code you requested:
```java
public void marshall(AcceptCertificateTransferRequest acceptCertificateTransferRequest, ProtocolMarshaller protocolMarshaller) {
if (acceptCertificateTransferRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall... | Create a Java method that does the following: "marshalls the given AcceptCertificateTransferRequest to the given protocolMarshaller.". |
Of course, here is the Java code you requested:
```java
public static boolean isAssignable(Class<?> targetType, Class<?> sourceType) {
if (null == targetType || null == sourceType) {
return false;
}
// 对象类型
if (targetType.isAssignableFrom(sourceType)) {
return true;
}
// 基本类型
if (targe... | Create a Java method that does the following: "Checks if the targetType is assignable from the sourceType.". |
Of course, here is the Java code you requested:
```java
public static ConversionException newConversionException(Throwable cause, String message, Object... args) {
return new ConversionException(format(message, args), cause);
}
```
Hope this helps! | Create a Java method that does the following: "Creates a ConversionException with the specified message and exception stack.". |
Of course, here is the Java code you requested:
```java
private void addSlab(int minimumSize) {
int nextSlabSize;
if (bytesUsed == 0) {
nextSlabSize = initialSlabSize;
} else if (bytesUsed > maxCapacityHint / 5) {
// to avoid an overhead of up to twice the needed size, we get linear when appro... | Create a Java method that does the following: "Add a new slab to the list of slabs.". |
Of course, here is the Java code you requested:
```java
public void setRetryImage(Drawable drawable, ScalingUtils.ScaleType scaleType) {
setChildDrawableAtIndex(RETRY_IMAGE_INDEX, drawable);
getScaleTypeDrawableAtIndex(RETRY_IMAGE_INDEX).setScaleType(scaleType);
}
```
Hope this helps! | Create a Java method that does the following: "Sets the retry image drawable.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public void reduce(BytesWritable key,
Iterator<BytesWritable> iterator,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
wr... | Create a Java method that does the following: "This method is called by the reduce method to reduce the contents of a single key.". |
Of course, here is the Java code you requested:
```java
public static <C extends Collection<E>, E> Iterator<C> unchain(int channelSize, Supplier<C> channelProvider, E... array) {
return new UnchainIterator<C, E>(channelSize, new ArrayIterator<E>(array), channelProvider);
}
```
Hope this helps! | Create a Java method that does the following: "Unchain an array of elements.". |
Of course, here is the Java code you requested:
```java
public InsertAllResponse insertAll(String datasetName, String tableName) {
// [START bigquery_table_insert_rows]
TableId tableId = TableId.of(datasetName, tableName);
// Values of the row to insert
Map<String, Object> rowContent = new HashMap<>();... | Create a Java method that does the following: "Example of inserting all rows into a table.". |
Of course, here is the Java code you requested:
```java
@Override
public RateLimiter rateLimiter(String name, String configName) {
return computeIfAbsent(name, () -> RateLimiter.of(name, getConfiguration(configName)
.orElseThrow(() -> new ConfigurationNotFoundException(configName))));
}
```
Hope this helps! | Create a Java method that does the following: "Get a rate limiter by name and configuration name.". |
Of course, here is the Java code you requested:
```java
public static TimeZone getGmtTimeZone(final String pattern) {
if ("Z".equals(pattern) || "UTC".equals(pattern)) {
return GREENWICH;
}
final Matcher m = GMT_PATTERN.matcher(pattern);
if (m.matches()) {
final... | Create a Java method that does the following: "Gets the GMT time zone.". |
Of course, here is the Java code you requested:
```java
public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; ... | Create a Java method that does the following: "Check if two JSON arrays are similar.". |
Of course, here is the Java code you requested:
```java
public OJBLock createIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger)
{
OJBLock result = null;
switch(((Integer) isolationId).intValue())
{
case LockManager.IL_READ_UNCOMMITTED:
... | Create a Java method that does the following: "Creates an instance of the appropriate class based on the isolation level specified.". |
Of course, here is the Java code you requested:
```java
public static Mean[] newArray(int dimensionality) {
Mean[] arr = new Mean[dimensionality];
for(int i = 0; i < dimensionality; i++) {
arr[i] = new Mean();
}
return arr;
}
```
Hope this helps! | Create a Java method that does the following: "Create a new array of Mean.". |
Of course, here is the Java code you requested:
```java
public final OrganizationSettings getOrganizationSettings(String name) {
GetOrganizationSettingsRequest request =
GetOrganizationSettingsRequest.newBuilder().setName(name).build();
return getOrganizationSettings(request);
}
```
Hope this helps... | Create a Java method that does the following: "Gets the organization settings for a single user.". |
Of course, here is the Java code you requested:
```java
public IgnorableOperand ignoreError(Exception e) {
append(token, e.getMessage());
return IgnorableOperand.getInstance();
}
```
Hope this helps! | Create a Java method that does the following: "Ignore an exception.". |
Of course, here is the Java code you requested:
```java
public static <E extends Enum<E>> TypeInformation<E> ENUM(Class<E> enumType) {
return new EnumTypeInfo<>(enumType);
}
```
Hope this helps! | Create a Java method that does the following: "Returns a type information for an enum type.". |
Of course, here is the Java code you requested:
```java
public static Certificate readCertificate(String type, InputStream in, char[] password, String alias) {
final KeyStore keyStore = readKeyStore(type, in, password);
try {
return keyStore.getCertificate(alias);
} catch (KeyStoreException e) {
throw... | Create a Java method that does the following: "Reads a certificate from an input stream.". |
Of course, here is the Java code you requested:
```java
public OverWindow as(Expression alias) {
return new OverWindow(
alias,
partitionBy,
orderBy,
new CallExpression(BuiltInFunctionDefinitions.UNBOUNDED_RANGE, Collections.emptyList()),
Optional.empty());
}
```
Hope this helps! | Create a Java method that does the following: "Returns a new OverWindow object with the specified alias.". |
Of course, here is the Java code you requested:
```java
public void marshall(ListByteMatchSetsRequest listByteMatchSetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listByteMatchSetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
... | Create a Java method that does the following: "Creates the marshalling method for the ANSWER tag.". |
Of course, here is the Java code you requested:
```java
@Override
public void destroy() {
if (monitoringDisabled || !instanceEnabled) {
return;
}
final long start = System.currentTimeMillis();
try {
if (filterContext != null) {
filterContext.destroy();
}
} finally {
final String... | Create a Java method that does the following: "Destroys the managed service.". |
Of course, here is the Java code you requested:
```java
public FNCFNNRGLen createFNCFNNRGLenFromString(EDataType eDataType, String initialValue) {
FNCFNNRGLen result = FNCFNNRGLen.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator o... | Create a Java method that does the following: "Create a FNCFNNRGLen value from a String.". |
Of course, here is the Java code you requested:
```java
public RequestSpecBuilder setKeyStore(String pathToJks, String password) {
spec.keyStore(pathToJks, password);
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Sets the keystore for the request.". |
Of course, here is the Java code you requested:
```java
public void marshall(Geometry geometry, ProtocolMarshaller protocolMarshaller) {
if (geometry == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshal... | Create a Java method that does the following: "marshalls the given geometry to the JSON object.". |
Of course, here is the Java code you requested:
```java
public final EObject entryRuleTerminalGroup() throws RecognitionException {
EObject current = null;
EObject iv_ruleTerminalGroup = null;
try {
// InternalXtext.g:3060:54: (iv_ruleTerminalGroup= ruleTerminalGroup EOF )
... | Create a Java method that does the following: "Use this method to look for a RuleTerminalGroup in the language.". |
Of course, here is the Java code you requested:
```java
public static final <K, V> PropertiesIterator<K, V> newPropertiesIterator( Map<K, V> properties )
{
return new PropertiesIterator<K, V>(null, properties);
}
```
Hope this helps! | Create a Java method that does the following: "Creates a new PropertiesIterator.". |
Of course, here is the Java code you requested:
```java
public void deleteAll() {
if(trackedFiles.size() == 0) {
return;
}
ArrayList<File> files = new ArrayList<File>(trackedFiles);
Collections.sort(files, filePathComparator);
for(File file : files) {
i... | Create a Java method that does the following: "Delete all the files in the cache.". |
Of course, here is the Java code you requested:
```java
public void launchAddBufferPoolDialog() {
if (addBufferPoolDialog == null) {
addBufferPoolDialog = new AddResourceDialog(
securityFramework.getSecurityContext(getProxy().getNameToken()),
resourceDescript... | Create a Java method that does the following: "Launch a AddBufferPoolDialog.". |
Of course, here is the Java code you requested:
```java
@Override
public int compareTo(Vulnerability v) {
return new CompareToBuilder()
.append(this.name, v.name)
.toComparison();
}
```
Hope this helps! | Create a Java method that does the following: "Compares two vulnerability objects.". |
Of course, here is the Java code you requested:
```java
@Override
public Fixture getFixture(String fixtureName, String... params) throws Throwable
{
Fixture fixture;
if (params.length != 0)
{
// When params are used, we use the PlainOldSystemUnderDevelopment to instantiate the fixture
// t... | Create a Java method that does the following: "This method is used to get the fixture object from the BeanFactory.". |
Of course, here is the Java code you requested:
```java
private int getSourcePixel(int[] srcImage, int x, int y)
{
int x1 = Math.max(0, x);
x1 = Math.min(width - 1, x1);
int y1 = Math.max(0, y);
y1 = Math.min(height - 1, y1);
return srcImage[x1 + y1 * width];
}
... | Create a Java method that does the following: "Gets the source pixel from the image.". |
Of course, here is the Java code you requested:
```java
@InService(TableWriterService.class)
public void writePage(Page page,
SegmentStream sOut,
long oldSequence,
int saveLength,
int saveTail,
in... | Create a Java method that does the following: "Write a single segment of a page to a segment stream.". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.