Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Can somebody add to the other java 8 features that i have mentioned

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Can somebody add to the other java 8 features that i have mentioned

    LocalDate ld = LocalDate.now();
    System.out.println("Local Date "+ld);
    LocalTime lt = LocalTime.now();
    System.out.println("Local Time "+lt);`enter code here`
    LocalDateTime timePoin = LocalDateTime.now();
    System.out.println("Local Date&Time "+timePoin);
    System.out.println("From LocalDateTime getting date only "+timePoin.toLocalDate());
    System.out.println("From LocalDateTime getting time only "+timePoin.toLocalTime());
    System.out.println("Manually setting date "+LocalDate.of(2012, Month.DECEMBER, 12));
    System.out.println("Manually setting time "+LocalTime.of(17, 18));
    System.out.println("String to date "+LocalDate.parse("2012-02-01"));
    System.out.println("String to time "+LocalTime.parse("10:15:30"));
    System.out.println("From LocalDateTime getting month only "+timePoin.getMonth());
    System.out.println("From LocalDateTime getting year only "+timePoin.getYear());
    System.out.println("From LocalDateTime setting and changing month and year "+timePoin.withDayOfMonth(1).withYear(2012));
    System.out.println("Adding weeks to date "+timePoin.plusWeeks(3));
    System.out.println("From LocalDateTime setting and changing date "+ timePoin.with(lastDayOfMonth()));
    System.out.println("Truncation of milliSeconds "+timePoin.truncatedTo(ChronoUnit.SECONDS));

    ZoneId id = ZoneId.of("Europe/Paris");
    System.out.println("Zone id "+id);
    ZonedDateTime zoned = ZonedDateTime.of(timePoin, id);
    System.out.println("Zone date and time "+zoned);

    Period period = Period.of(3, 2, 1);
    LocalDate newDate = ld.plus(period);
    System.out.println("After addingyears,months,days "+newDate);

    String d = String.join(", ", a, b, c);

    perList.stream().filter(e -> e.getAge() > 10).forEach(n -> perNewLList.add(n));
    perNewLList.forEach(n -> System.out.println("Name" + n.getName() + " Age" + n.getAge()));
    enter code here
    int total = perList.stream().collect(Collectors.summingInt(Per son::getAge));

    List<String> str1=perList.stream().map(Person::getName).collect (Collectors.toList());


  2. #2
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    411
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Can somebody add to the other java 8 features that i have mentioned

    Add to the list as to help you finish your homework?

    A piece of advice - find the documentation for Java version 8.1 and have a look at any
    new methods.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,050
    My Mood
    Mellow
    Thanks
    184
    Thanked 650 Times in 637 Posts

    Default Re: Can somebody add to the other java 8 features that i have mentioned

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

Similar Threads

  1. Help with ArrayList Features
    By blobby404 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 19th, 2014, 03:08 AM
  2. Java 1.7 features
    By Reddi.Java in forum Member Introductions
    Replies: 1
    Last Post: February 8th, 2013, 08:01 AM
  3. WORKING BUT SOME FEATURES NOT
    By kariolos in forum What's Wrong With My Code?
    Replies: 16
    Last Post: May 26th, 2011, 06:25 AM

Tags for this Thread