Tabnine Logo
Long.valueOf
Code IndexAdd Tabnine to your IDE (free)

How to use
valueOf
method
in
java.lang.Long

Best Java code snippets using java.lang.Long.valueOf (Showing top 20 results out of 55,872)

origin: google/guava

 @Override
 public Long apply(Integer n) {
  return Long.valueOf(n);
 }
};
origin: spring-projects/spring-framework

/**
 * Get the heartbeat header.
 */
@Nullable
public long[] getHeartbeat() {
  String rawValue = getFirst(HEARTBEAT);
  String[] rawValues = StringUtils.split(rawValue, ",");
  if (rawValues == null) {
    return null;
  }
  return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
}
origin: spring-projects/spring-framework

public long[] getHeartbeat() {
  String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER);
  String[] rawValues = StringUtils.split(rawValue, ",");
  if (rawValues == null) {
    return Arrays.copyOf(DEFAULT_HEARTBEAT, 2);
  }
  return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
}
origin: spring-projects/spring-framework

@Override
@CachePut(cacheNames = "testCache", condition = "#arg.equals(3)")
public Long conditionalUpdate(Object arg) {
  return Long.valueOf(arg.toString());
}
origin: google/guava

public void testCompare() {
 for (long x : VALUES) {
  for (long y : VALUES) {
   // note: spec requires only that the sign is the same
   assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
  }
 }
}
origin: google/guava

 void check() {
  runTester();
  FromTo<?, ?> defaultFunction = (FromTo<?, ?>) getDefaultParameterValue(0);
  assertEquals(0, defaultFunction.apply(null));
  Supplier<?> defaultSupplier = (Supplier<?>) defaultFunction;
  assertEquals(Long.valueOf(0), defaultSupplier.get());
 }
}
origin: spring-projects/spring-framework

@Override
@Caching(put = { @CachePut("primary"), @CachePut("secondary") })
public Long multiUpdate(Object arg1) {
  return Long.valueOf(arg1.toString());
}
origin: spring-projects/spring-framework

@Override
@Caching(put = { @CachePut("primary"), @CachePut("secondary") })
public Long multiUpdate(Object arg1) {
  return Long.valueOf(arg1.toString());
}
origin: spring-projects/spring-framework

@Test
public void convertCollectionToObject() {
  List<Long> list = Collections.singletonList(3L);
  Long result = conversionService.convert(list, Long.class);
  assertEquals(Long.valueOf(3), result);
}
origin: spring-projects/spring-framework

@Test
public void nullSafeToStringWithObjectArray() {
  Object[] array = {"Han", Long.valueOf(43)};
  assertEquals("{Han, 43}", ObjectUtils.nullSafeToString(array));
}
origin: spring-projects/spring-framework

@Test
public void withLong() {
  Collection<Long> col = new HashSet<>(1);
  col.add(5L);
  assertEquals(Long.valueOf(5L), DataAccessUtils.uniqueResult(col));
  assertEquals(Long.valueOf(5L), DataAccessUtils.requiredUniqueResult(col));
  assertEquals(Long.valueOf(5L), DataAccessUtils.objectResult(col, Long.class));
  assertEquals("5", DataAccessUtils.objectResult(col, String.class));
  assertEquals(5, DataAccessUtils.intResult(col));
  assertEquals(5, DataAccessUtils.longResult(col));
}
origin: ReactiveX/RxJava

@Test(timeout = 1000, expected = NoSuchElementException.class)
public void testSimpleJustNext() {
  TestScheduler scheduler = new TestScheduler();
  Flowable<Long> source = Flowable.interval(1, TimeUnit.SECONDS, scheduler).take(10);
  Iterable<Long> iter = source.blockingLatest();
  Iterator<Long> it = iter.iterator();
  // only 9 because take(10) will immediately call onComplete when receiving the 10th item
  // which onComplete will overwrite the previous value
  for (int i = 0; i < 10; i++) {
    scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
    Assert.assertEquals(Long.valueOf(i), it.next());
  }
}
origin: ReactiveX/RxJava

@Test(timeout = 1000, expected = NoSuchElementException.class)
public void testSimpleJustNext() {
  TestScheduler scheduler = new TestScheduler();
  Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);
  Iterable<Long> iter = source.blockingLatest();
  Iterator<Long> it = iter.iterator();
  // only 9 because take(10) will immediately call onComplete when receiving the 10th item
  // which onComplete will overwrite the previous value
  for (int i = 0; i < 10; i++) {
    scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
    Assert.assertEquals(Long.valueOf(i), it.next());
  }
}
origin: spring-projects/spring-framework

@Test
public void convertObjectToObjectFinderMethodWithIdConversion() {
  TestEntity entity = conversionService.convert("1", TestEntity.class);
  assertEquals(Long.valueOf(1), entity.getId());
}
origin: spring-projects/spring-framework

@Test
public void convertObjectToObjectFinderMethod() {
  TestEntity e = conversionService.convert(1L, TestEntity.class);
  assertEquals(Long.valueOf(1), e.getId());
}
origin: spring-projects/spring-framework

@Test
public void setFieldWithNullNameAndNullType() throws Exception {
  exception.expect(IllegalArgumentException.class);
  exception.expectMessage(startsWith("Either name or type"));
  setField(person, null, Long.valueOf(99), null);
}
origin: spring-projects/spring-framework

@Test
public void setFieldWithNullTargetObject() throws Exception {
  exception.expect(IllegalArgumentException.class);
  exception.expectMessage(startsWith("Either targetObject or targetClass"));
  setField((Object) null, "id", Long.valueOf(99));
}
origin: spring-projects/spring-framework

@Test
public void setFieldWithWrongType() throws Exception {
  exception.expect(IllegalArgumentException.class);
  exception.expectMessage(startsWith("Could not find field"));
  setField(person, "id", Long.valueOf(99), String.class);
}
origin: spring-projects/spring-framework

@Test
public void setFieldWithBogusName() throws Exception {
  exception.expect(IllegalArgumentException.class);
  exception.expectMessage(startsWith("Could not find field 'bogus'"));
  setField(person, "bogus", Long.valueOf(99), long.class);
}
origin: spring-projects/spring-framework

@Test
public void contentLength() {
  Mono<ServerResponse> result = ServerResponse.ok().contentLength(42).build();
  StepVerifier.create(result)
      .expectNextMatches(response -> Long.valueOf(42).equals(response.headers().getContentLength()))
      .expectComplete()
      .verify();
}
java.langLongvalueOf

Javadoc

Returns a Long instance for the specified long value.

If it is not necessary to get a new Long instance, it is recommended to use this method instead of the constructor, since it maintains a cache of instances which may result in better performance.

Popular methods of Long

  • parseLong
    Parses the string argument as a signed long in the radix specified by the second argument. The chara
  • toString
    Returns a string representation of the first argument in the radix specified by the second argument.
  • longValue
    Returns the value of this Long as a long value.
  • <init>
    Constructs a newly allocated Long object that represents the long value indicated by the String para
  • intValue
    Returns the value of this Long as an int.
  • equals
    Compares this object to the specified object. The result is true if and only if the argument is not
  • hashCode
  • toHexString
    Returns a string representation of the longargument as an unsigned integer in base 16.The unsigned l
  • compareTo
    Compares this Long object to another object. If the object is a Long, this function behaves likecomp
  • compare
    Compares two long values numerically. The value returned is identical to what would be returned by:
  • doubleValue
    Returns the value of this Long as a double.
  • decode
    Decodes a String into a Long. Accepts decimal, hexadecimal, and octal numbers given by the following
  • doubleValue,
  • decode,
  • numberOfLeadingZeros,
  • numberOfTrailingZeros,
  • bitCount,
  • signum,
  • reverseBytes,
  • toBinaryString,
  • shortValue

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now