201621123047 Summary of the NINETH study of Java programming

Source: Internet
Author: User

1. Summary of this week's study

2. Written assignment 2.1. The deletion of the specified element in the list (topic set) 2.1.1 Experimental summary. and answer: List at least 2 ways to delete elements in the list.
    • Method One:

        for(int i=list.size()-1;i>=0;i--){        if(list.get(i)==0)            list.remove(i);

      Method Two:

       for(Iterator<Integer> iterator = list.iterator();iterator.hasNext(); ){        int e = iterator.next();        if(e===0)            iterator.remove();
2.2. Count the number of words in the text and sort them by the number of occurrences (topic set) 2.2.1
    • Create a TreeMap object map
    • Loop through the words until you encounter "!!!! "Exit, add no corresponding key in map, how value is 1, otherwise value+1."
    • Converts a Map object into a list object.
    • The collections interface sorts the map objects.
    • The length of the key of the output map
    • The first 10 elements of the output.
2.2.2 Experiment Summary 2.3. Inverted index (problem set) 2.3.1 Your code run results

2.3.2 Pseudo-code (no copy code, otherwise deducted)
    • Create the implementation class TREEMAP for the map object, value is the ArrayList class.
      From the regular expression, the reading of each line of the word is taken out, if not in key, value for the number of rows directly into the map object, if there is, then see if the corresponding value has the values containing to the row, no re-join.
    • Traverses the output map object.
    • First determine whether the input words are all in the Map object, and if so, then the intersection of their number of rows, and then output.
2.3.3 Experiment Summary
    • It takes a long time to do this, and when you do this, it doesn't take into account that if the value in the map has the same values in the ArrayList (that is, two identical words are in the same row), the result is the same, but the submission is wrong.
2.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 List , with several student objects used for subsequent tests.

2.4.1 using traditional methods to write a search method list Search (List Stulist, Long ID, String name, int age, Gender Gender, Boolean joinsacm), and then call the method to id> a value, name a value, age> a value, Gender a Values, students who have participated in the ACM contest are screened out and put into a new collection. Called in Main, and then outputs the result. (: Appearance number, name) 2.4.2 uses the stream () in Java8, filter (), collect () to write the code with the same 4.1, and test (to appear 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 number of the school) 2.2.5. Generic class: Generalstack

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

The code 2.5.2 of the 2.5.1 Generalstack interface shows what the benefits of generics are compared to the arraylistintegerstack in the previous job 3. Code Cloud and PTA3.1. Code Cloud Code submission record 3.2 PTA problem set completion picture


3.3 Count the amount of code completed this week 3
weeks Total code amount new Code volume Total Files number of new files added
1 5 5
2 468 382 ten
818 " + 6
5 1421 403 + 6
+ 2123 702 $ +
7 2789 666 6
8 3501 712 9
9 4100 599 up 7
4. Assess how much you understand Java

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

Degree of dimension
Grammar PTA Topic has been able to easily take care of, there is nothing difficult to pour my grammar problems
Object-oriented design capability can skillfully use object-oriented thinking to model the problem to be solved
Application capabilities You can use Java to write some useful gadgets
Number of lines of code so far 5000

201621123047 Summary of the NINETH study of Java programming

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.