com.google.common.collect.ObjectArrays#concat ( )源码实例Demo

下面列出了com.google.common.collect.ObjectArrays#concat ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: codebuff   文件: SimpleTimeLimiter.java
private static Exception throwCause(Exception e, boolean combineStackTraces) throws Exception {
  Throwable cause = e.getCause();
  if (cause == null) {
    throw e;
  }
  if (combineStackTraces) {
    StackTraceElement[] combined = ObjectArrays.concat(cause.getStackTrace(), e.getStackTrace(), StackTraceElement.class);
    cause.setStackTrace(combined);
  }
  if (cause instanceof Exception) {
    throw (Exception) cause;
  }
  if (cause instanceof Error) {
    throw (Error) cause;
  }
  // The cause is a weird kind of Throwable, so throw the outer exception.
  throw e;
}
 
源代码2 项目: codebuff   文件: SimpleTimeLimiter.java
private static Exception throwCause(Exception e, boolean combineStackTraces) throws Exception {
  Throwable cause = e.getCause();
  if (cause == null) {
    throw e;
  }
  if (combineStackTraces) {
    StackTraceElement[] combined = ObjectArrays.concat(cause.getStackTrace(), e.getStackTrace(), StackTraceElement.class);
    cause.setStackTrace(combined);
  }
  if (cause instanceof Exception) {
    throw (Exception) cause;
  }
  if (cause instanceof Error) {
    throw (Error) cause;
  }
  // The cause is a weird kind of Throwable, so throw the outer exception.
  throw e;
}
 
源代码3 项目: Mixin   文件: RedirectInjector.java
RedirectedInvokeData(Target target, MethodInsnNode node) {
    super(target);
    this.node = node;
    this.returnType = Type.getReturnType(node.desc);
    this.targetArgs = Type.getArgumentTypes(node.desc);
    this.handlerArgs = node.getOpcode() == Opcodes.INVOKESTATIC
            ? this.targetArgs
            : ObjectArrays.concat(Type.getObjectType(node.owner), this.targetArgs);
}
 
源代码4 项目: browserup-proxy   文件: TrustSource.java
/**
 * Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus zero or more additional
 * trusted X509Certificates. If trustedCertificates is null or empty, returns this same TrustSource.
 *
 * @param trustedCertificates X509Certificates of CAs to trust
 * @return a new TrustSource containing this TrustSource's trusted CAs plus the specified CAs
 */
public TrustSource add(X509Certificate... trustedCertificates) {
    if (trustedCertificates == null || trustedCertificates.length == 0) {
        return this;
    }

    X509Certificate[] newTrustedCAs = ObjectArrays.concat(trustedCAs, trustedCertificates, X509Certificate.class);

    return new TrustSource(newTrustedCAs);
}
 
源代码5 项目: CapturePacket   文件: TrustSource.java
/**
 * Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus zero or more additional
 * trusted X509Certificates. If trustedCertificates is null or empty, returns this same TrustSource.
 *
 * @param trustedCertificates X509Certificates of CAs to trust
 * @return a new TrustSource containing this TrustSource's trusted CAs plus the specified CAs
 */
public TrustSource add(X509Certificate... trustedCertificates) {
    if (trustedCertificates == null || trustedCertificates.length == 0) {
        return this;
    }

    X509Certificate[] newTrustedCAs = ObjectArrays.concat(trustedCAs, trustedCertificates, X509Certificate.class);

    return new TrustSource(newTrustedCAs);
}
 
源代码6 项目: xtext-core   文件: GrammarElementsInterner.java
EObject[] prependedGrammarElements() {
	if(grammarElements instanceof EObject) {
		return new EObject[] {grammarElement, (EObject) grammarElements};
	} else {
		return ObjectArrays.concat(grammarElement, (EObject[]) grammarElements);
	}
}
 
源代码7 项目: immutables   文件: Proto.java
static @Nullable String[] concat(@Nullable String[] first, @Nullable String[] second) {
  if (first == null)
    return second;
  if (second == null)
    return first;
  return ObjectArrays.concat(first, second, String.class);
}
 
源代码8 项目: ProjectAres   文件: LaneMatchModule.java
private static Block getAdjacentRegionBlock(Region region, Block origin) {
    for(BlockFace face : ObjectArrays.concat(CARDINAL_DIRECTIONS, DIAGONAL_DIRECTIONS, BlockFace.class)) {
        Block adjacent = origin.getRelative(face);
        if(region.contains(BlockUtils.center(adjacent).toVector())) {
            return adjacent;
        }
    }
    return null;
}
 
源代码9 项目: AndroidHttpCapture   文件: TrustSource.java
/**
 * Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus zero or more additional
 * trusted X509Certificates. If trustedCertificates is null or empty, returns this same TrustSource.
 *
 * @param trustedCertificates X509Certificates of CAs to trust
 * @return a new TrustSource containing this TrustSource's trusted CAs plus the specified CAs
 */
public TrustSource add(X509Certificate... trustedCertificates) {
    if (trustedCertificates == null || trustedCertificates.length == 0) {
        return this;
    }

    X509Certificate[] newTrustedCAs = ObjectArrays.concat(trustedCAs, trustedCertificates, X509Certificate.class);

    return new TrustSource(newTrustedCAs);
}
 
源代码10 项目: dremio-oss   文件: LBlockHashTableNoSpill.java
private void addDataBlocks(){

    // make sure can fit the next batch.
    listener.resized(currentOrdinal + MAX_VALUES_PER_BATCH);

    try(RollbackCloseable rollbackable = new RollbackCloseable()) {

      {
        FixedBlockVector newFixed = new FixedBlockVector(allocator, pivot.getBlockWidth());
        rollbackable.add(newFixed);
        newFixed.ensureAvailableBlocks(MAX_VALUES_PER_BATCH);
        fixedBlocks = ObjectArrays.concat(fixedBlocks, newFixed);
        tableFixedAddresses = Longs.concat(tableFixedAddresses, new long[]{newFixed.getMemoryAddress()});
      }

      {
        VariableBlockVector newVariable = new VariableBlockVector(allocator, pivot.getVariableCount());
        rollbackable.add(newVariable);
        newVariable.ensureAvailableDataSpace(pivot.getVariableCount() == 0 ? 0 : MAX_VALUES_PER_BATCH * defaultVariableLengthSize);
        variableBlocks = ObjectArrays.concat(variableBlocks, newVariable);
        initVariableAddresses = Longs.concat(initVariableAddresses, new long[]{newVariable.getMemoryAddress()});
        openVariableAddresses = Longs.concat(openVariableAddresses, new long[]{newVariable.getMemoryAddress()});
        maxVariableAddresses = Longs.concat(maxVariableAddresses, new long[]{newVariable.getMaxMemoryAddress()});
      }
      rollbackable.commit();
    } catch (Exception e) {
      throw Throwables.propagate(e);
    }
  }
 
源代码11 项目: science-journal   文件: SimpleBackupAgent.java
@Override
public void onCreate() {
  Context context = getApplicationContext();
  String defaultPrefsName = getDefaultSharedPreferencesName(context);
  String[] accountsPrefsNames = AccountsUtils.getSharedPreferencesNamesForAllAccounts(context);
  SharedPreferencesBackupHelper helper =
      new SharedPreferencesBackupHelper(
          this, ObjectArrays.concat(defaultPrefsName, accountsPrefsNames));
  addHelper(PREFS_BACKUP_KEY, helper);
}
 
源代码12 项目: opennars   文件: IntersectionInt.java
/**
 * Try to make a new compound from two term. Called by the inference rules.
 * @param term1 The first component
 * @param term2 The second component
 * @return A compound generated or a term it reduced to
 */
public static Term make(final Term term1, final Term term2) {
    
    if ((term1 instanceof SetExt) && (term2 instanceof SetExt)) {
        // set union
        final Term[] both = ObjectArrays.concat(
                ((CompoundTerm) term1).term, 
                ((CompoundTerm) term2).term, Term.class);
        return SetExt.make(both);
    }
    if ((term1 instanceof SetInt) && (term2 instanceof SetInt)) {
        // set intersection
        final NavigableSet<Term> set = Term.toSortedSet(((CompoundTerm) term1).term);
        
        set.retainAll(((CompoundTerm) term2).asTermList());     
        
        //technically this can be used directly if it can be converted to array
        //but wait until we can verify that NavigableSet.toarray does it or write a helper function like existed previously
        return SetInt.make(set.toArray(new Term[0]));
    }
    
    final List<Term> se = new ArrayList();
    if (term1 instanceof IntersectionInt) {
        ((CompoundTerm) term1).addTermsTo(se);
        if (term2 instanceof IntersectionInt) {
            // (&,(&,P,Q),(&,R,S)) = (&,P,Q,R,S)                
            ((CompoundTerm) term2).addTermsTo(se);
        }               
        else {
            // (&,(&,P,Q),R) = (&,P,Q,R)
            se.add(term2);
        }               
    } else if (term2 instanceof IntersectionInt) {
        // (&,R,(&,P,Q)) = (&,P,Q,R)
        ((CompoundTerm) term2).addTermsTo(se);
        se.add(term1);
    } else {
        se.add(term1);
        se.add(term2);
    }
    return make(se.toArray(new Term[0]));
}
 
源代码13 项目: vjtools   文件: ArrayUtil.java
/**
 * 添加元素到数组头.
 */
public static <T> T[] concat(@Nullable T element, T[] array) {
	return ObjectArrays.concat(element, array);
}
 
源代码14 项目: vjtools   文件: ArrayUtil.java
/**
 * 添加元素到数组末尾.
 */
public static <T> T[] concat(T[] array, @Nullable T element) {
	return ObjectArrays.concat(array, element);
}
 
源代码15 项目: xtext-eclipse   文件: XtextEditor.java
@Override
protected String[] collectContextMenuPreferencePages() {
	String[] commonPages = super.collectContextMenuPreferencePages();
	String[] langSpecificPages = collectLanguageContextMenuPreferencePages();
	return ObjectArrays.concat(langSpecificPages, commonPages, String.class);
}
 
源代码16 项目: business   文件: RepositoryPaginatorContext.java
private Repository.Option[] applyOffset(Repository.Option[] options, long offset) {
    return ObjectArrays.concat(options, new OffsetOption(offset));
}
 
源代码17 项目: NationStatesPlusPlus   文件: Global.java
@SuppressWarnings("unchecked")
@Override
public <T extends EssentialFilter> Class<T>[] filters() {
	return (Class[]) ObjectArrays.concat(GzipFilter.class, super.filters());
}
 
源代码18 项目: business   文件: RepositoryPaginatorContext.java
private Repository.Option[] applyLimit(Repository.Option[] options, long limit) {
    return ObjectArrays.concat(options, new LimitOption(limit));
}
 
源代码19 项目: j360-dubbo-app-all   文件: ArrayUtil.java
/**
 * 添加元素到数组末尾,没有银弹,复制扩容.
 */
public static <T> T[] concat(T[] array, @Nullable T element) {
	return ObjectArrays.concat(array, element);
}
 
源代码20 项目: Selenium-Foundation   文件: LocalSeleniumGrid.java
/**
 * Combine driver dependency contexts with the specified core Selenium Grid contexts.
 *
 * @param dependencyContexts core Selenium Grid dependency contexts
 * @param driverPlugin driver plug-in from which to acquire dependencies
 * @return combined contexts for Selenium Grid dependencies
 */
public static String[] combineDependencyContexts(String[] dependencyContexts, DriverPlugin driverPlugin) {
    return ObjectArrays.concat(dependencyContexts, driverPlugin.getDependencyContexts(), String.class);
}