201621123083 Java Programming 9th Week of study summary

Source: Internet
Author: User

1. This week study summary 1.1 summarizes the set and generic related content in the way you like (mind map or other).

2. Written work

Collection of this homework question set

1. Deletion of the specified element in list (title of topic) 1.1 Experimental summary. and answer: List at least 2 ways to delete elements in the list.
  • Traverse the delete element from the previous

    for(int i=0;i<list.size();i++){if(list.get(i).equals(str)){    list.remove(i);    i--;}}
  • To traverse a delete element from a backward forward

    for(int i=list.size()-1;i>=0;i--){if(list.get(i).equals(str)){    list.remove(i);}}
    2. Count the number of words in the text and sort by the number of occurrences (title of the topic) 2.1 Pseudo-code (not copy code, otherwise deducted)

    Create a new HashMap
    Iterate through the English words in the statement and touch the!!!!! Just break.
    Save each word and number of times to map
    Total number of words output
    Create a new ArrayList to put the words in the map into an array
    Sorting words with the collections interface
    Number of words and occurrences of the top 10 output

    2.2 Experimental Summary

    In the experimental class, the teacher has explained the previous section, the main problem is to solve the implementation of the collections interface comparison

    3. Inverted index (problem set)

    The subject is more difficult, do not come out does not matter. But must have own thinking process, must have the submission result.

    3.1 Your code runs the result

    3.2 pseudocode (Do not copy code, otherwise deduct)

    Create a new HashMap
    Iterate through the English words in the statement and touch the!!!!! Just break.
    Create a new ArrayList to put the words in the map into an array
    Create ArrayList to add the contents of each row to an array
    Traversing the contents of the output map
    The Read keyword outputs the number of rows it contains
    If the specified word output "found 0 results" does not exist in the map, the output intersection and the number of rows corresponding to the intersection number are present

    3.3 Experimental Summary
  • To define a dynamic array to store each line of input
  • When adding the number of rows to ArrayList, determine if it already exists

    4.Stream and Lambda

    Write a student class that has the following properties:
    Private Long ID;
    private String name;
    private int age;
    Private Gender gender;//enum type
    Private Boolean JOINSACM; Have you participated in the ACM contest?
    Creates a collection object, such as a list

    4.1 Writing a search method using traditional methods list

    4.2 Use the stream () in Java8, filter (), collect () to write the code with the same 4.1, and test (to show the test data). When building a test collection, in addition to the normal student object, add some null to the collection, and the method you write should handle the null instead of throwing an exception. (: The school number appears)
    List<Student> newStudent = student.stream().filter(e -> e!=null&&e.getId()>3&&e.getName().equals("5")&&e.getAge()>17&&e.getGender()==Gender.man&&e.isJoinsACM()==true).collect(Collectors.toList());

    5. Generic type: Generalstack

    The Generalstack of jmu-java-05-collection of title set

    5.1 Code for Generalstack interface

    5.2 What are the benefits of generics compared to arraylistintegerstack in previous assignments?

    Using generics, you can change the type of elements that are in the stack and apply to all types of data

    3. Code Cloud and PTA

    Topic Set: jmu-java-05-Collection

    3.1. Code Cloud codes Submission record

    In the Code cloud Project, select statistics-commits history-set time period, and then search for and

    3.2 PTA Problem set complete situation diagram

    Two graphs are required (1. Ranking chart. 2.PTA Submission list diagram)

    3.3 Count the amount of code completed this week

    The weekly code statistics need to be fused into a single table.
    Can you achieve your goals?

Week Time Total code Amount New Code Volume total number of files number of new files
10 2811 264 52 5
4. Assess how much you understand Java

Try to evaluate how much you understand Java from the following dimensions

Dimension of degree
Grammar The problem of PTA can be completed basically
Object-oriented design capabilities Can basically use object-oriented thinking to model the problem to be solved
Application capabilities
Number of lines of code so far 3000

201621123083 Java Programming 9th Week of study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.