Monday, December 18, 2023

Surface Area of a Cone

So I recently encountered a challenging math problem intended for an 8th grader. Find the surface area of a frustum. That is, a circus elephant stand or a bucket. Given the circumference of the top and bottom and the height between.

Wow, that's a tough problem for an 8th grader and I am frustrated at this frustum problem because I never learned the formulas needed. It would be relatively straight forward if I know how to find the surface area of a cone but I don't know. Not that I forgot it but just never learned it, although I know how to find the volume of a cone. That 1/3 base * height formula is actually not exactly straight forward to derive either. I know these formulas are not so useful in life, I know. But the spirit of math should be: if there is an answer find the answer.

Nowadays it is easy to look up the formula. Note the cone has the side and the bottom. The formula looks like this:

That looks a little intimidating. A cone is a paper cup. Surface area is the paper cup plus the bottom circle. The area of the paper cup is the "lateral surface area" and it is π r L, where r is the radius, and L is the slanted height. The slanted height L is also square root of h2 + r2, straight from the Pythagorean Theorem. Neat. So the formula above is area of the paper cup plus the area of the bottom circle. But where did this lateral area formula π r L come from. I looked up a few explanations and none provide satisfactory explanation. Allow me explain.

Now look at the paper cup. Imagine flattening it. It is a section of a circle. What is its radius? L.
What's the circumference of the big circle that the paper cup is part of? 2 π L.
What's its area? π L 2.
But we are interested in the section, the paper cup. Geez I'll need the angle but I don't know.
But I do know its rim's length. That would be the circumference of the bottom of the cone: π r2.
Then the paper cup's area is a fraction of the big circle's area π L 2.
The fraction is rim over entire circumference, which is π r2 over 2 π L. Multiply it out, many things cancel, and then you will get π r L. See, if the cone is entirely flat, then r=L it is just π r2.

Armed with this lateral cone area formula π r L, there is still a bit of calculation to find surface area of a frustum, which is top and bottom circle area. Plus the difference of lateral area of bigger cone and smaller cone. First I'll need the height of the cone which takes a bit of work with similar triangles to find out.

But the point is this: Do not ever just tell kids to use formulas, derive them! Deriving formula is learning math. Using the formula is applying math. Plugging in numbers in a formula which you don't know where it came is lowest form of math.

Wednesday, April 19, 2023

"Teen Takeover"

Dozens of teens terrorized downtown, beat and robbed a terrified woman. https://news.yahoo.com/disturbing-video-shows-terrified-woman-161836419.html

This is the street where I used to walk by everyday to work, and to school. Not too long ago there was endless looting and every store was boarded up and I don't know know if those looters were ever get caught (probably not).

The mayor-elect's response was "It was unacceptable", and "but don't demonize youth" https://abc7chicago.com/chicago-violence-brandon-johnson-teens-new-mayor/13143044.

People debate whether this is adequate response or not. What do you think? Well I think it was adequate, at least he didn't say it was acceptable. What did the police say? "... won't be tolerated" and "We strongly encourage parents to accompany their teens or have them remain under the supervision of a responsible adult. " Like their parents (if not null) still able to control these teenagers.

Waita minute just what is this "Yay we got active" thing on the video? These teenagers take joy of torturing the terrified victim!

Not too long ago some clueless traveler thing crowned Chicago as the "Best Big City in the United States" https://www.nbcchicago.com/news/local/chicago-voted-best-big-city-in-the-us-by-conde-nast-traveler-for-6th-year-in-a-row-heres-why/2957641/. I am not sure if crime was ever in its clueless magazine's cluessless consideration.

Look, it was unacceptable, and shameful and some strong response is needed as well as addressing the root cause.

Just why it happened in the first place? Do these teenagers have any demands? Were they protesting against something or demanding something I have no clue. Is it because they rob and terrorize, "because they can" because cops are so useless? Since even looting was fine what else is not fine? There are already dozens of gun violence just about everyday. Police basically can't put crimes in check.

Besides criticizing, what can you do about it?

Move out of Chicago is definitely a good move but that isn't the solution because that's avoiding the problem.

Why can't these kids just study hard, find work, live a good life and not terrorize others? Read the rest of Johnson's response: "...not constructive to demonize youth who have otherwise been starved of opportunities in their own communities". Yes, youth is not to be demonized, but waita minute, these youths were demonic!

Problem 1: is lack of opportunites a reason to terrorize downtown? Problem 2: why is there lack of opportunities in their communities?

Solution 1: I already do see flashing police cars on most intersections of the magnificent mile Michigan Avenenue. There needs to be the same in the less magnificent mile State Street. Every intersection needs one. The police need to keep its words: catch them put them on jail, although I have some doubt their ability to do so.

Now the bigger problem (#2) is why isn't there opportunities in their communities? I believe if there are any business in their communities they get robbed everyday and that's why nobody open business in there, and vicious cycle of poor beget violence, and violence beget more poor, etc.

This means: someone must invest in their communities (not my money please). Those who are super well to do (like top Hollywood, sports stars etc) that they admire, descend down to talk to these people, tell them what is proper and what is not. Create jobs. Promote Peace.

Now talk is easy to "create jobs". Decent paying jobs now have ridiculously high requirements and people prefer to loot instead of doing difficult jobs that pays little. Bump up the minimum wage to even higher does not solve that either.

Walmart had to close money-losing stores https://www.cnn.com/2023/04/12/business/walmart-chicago-stores-closing/index.html. Yes theft was one reason why they lose money.

So the long term solution is first the police must be fearful enough, must be capable enough. Stronger effective punishment needed. Then the city offer incentive to create business (for example low tax) and promise safety for business (security cameras, cops patroling etc) Jobs: there must be attainable jobs out there for those willing to work. Talk is easy, but who is willing to hire these teens and change their lives?

The ultimate solution is actually education. Brandon Johnson was a teacher he should have a better idea than me that education is actually the best solution here. But do the schools even talk about this after this incident? They go back to their endless (and useless) curriculum: alliteration, onomatopoeia, simile and metaphor, endless boring math drills and native Americans history (they don't even teach modern US history nor any world history and forever obsessed with explorers era). Schools should talk about this! and focus less on other (controversial) social issues.

Clueless travel magazine: do you still think Chicago is the best big city?

Wednesday, April 5, 2023

Chicago's new mayor

Brandon Johnson has won the mayor race in a tight race: 51% over 49%, in the second round against Paul Vallas. First round had 10 candidates and Vallas had 32% over Johnson's 21%. Voter turnout was just 33%. There are people dying to get right to vote and there are people who don't bother to vote.

Chicago is a mess. Can this new mayor fix all the problems? We will wait and see.

Tuesday, April 4, 2023

Javascript gotchas

Javascript truly is the most universal language as it runs in your browser and your phone('s browser) and also serverside. People nowadays can't stand types and don't like compiling and just obsessed with javascript frameworks. Decades ago it was mostly used for a little onclick event handler of your button or some annoying alert() or do some simple form validation.

I was astonished to find out that the computer science classic MIT textbook Structure and Interpretation of Computer Programs now has a Javascript version in placce of its original Scheme version which I have used in college!

New versions of Javascript come out every year See https://www.w3schools.com/js/js_versions.asp. It is hard to keep up and its caveats can be confusing.

Copy objects

Consider this little code, suppose you have a car object, then make a copy of it. change something in the copy, do you expect the original change?

let car = {
    model: 'Corolla',
    make: 'Toyota'
};
let car2 = car;
car2.model = 'Camry';
console.log(car);
console.log(car2);
console.log(car==car2);  
The output is
{ model: 'Camry', make: 'Toyota' }
{ model: 'Camry', make: 'Toyota' }
true
You changed the original car by modifying the copy and they are same object! This works like a pointer in C++. Now how do you actually make a distinct copy of an object? There are few ways to do this and there is shallow copy and deep copy. See this excellent tutorial: https://www.javascripttutorial.net/object/3-ways-to-copy-objects-in-javascript/

Let, var, const

In the beginning there was "var" and the "function", probably derived from Pascal as it faded into oblivion. Now there is this "let" and "const". "const" is a bit more straight forward, which is constant like other languages, to make you feel more secure that your variables aren't changing.

const a=1
a =2; // boom error trying to modify constant
But wait, redifining variable is not allowed but you can still change things within the variable
const mycar = {
    model: 'Corolla',
    make: 'Toyota'
};
mycar.model = 'RAV4'  // valid to change things inside the const myvar
console.log(mycar) 
mycar = {     // error: assignment to constant variable
    model:'Focus', 
    make:'Ford'
}
What's difference between "let" and "var"? "let" is local scope and "var" is global scope. "var" can be redeclared but "let" does not.
var a = 1
let b = 2
var a = "John" // ok
let b = "Mary" // not ok
Number type coersion
// adding is concat, if you have a string adding number both are like strings
console.log("10"+5); //105
console.log(10+"5");  //105
// but this only apply to add, other math operations treat it as number
console.log(10 - '5'); //5
console.log(10 * '5'); //50
console.log(10 / '5'); //2
console.log(10 % '5'); //0

//convert string to number
var a = '10';
var b = 5
var c = a-'0' + 5 // to convert string to number so you can do a add, one way is minus '0'
console.log(c) // 15
var d = Number(a)+b // or be explicit about it, or do parseInt
console.log(d) // 15

//boolean is coverted to 1 for true, 0 for false
console.log(true + 2);  // 3
console.log(false + 2); // 2
// string and number are considered double equal, but not triple equal
console.log(10 == '10') // true
console.log(10 === '10') // false

Friday, March 24, 2023

Estimate π by counting random numbers

So I was given a quiz: to estimate π by counting random numbers. This is known as the Monte Carlo method. Take random number x and y from 0..1, it can be inside or outside of a quarter circle. To estimate pi, just count how many dots are in.

First I was kinda totally shocked by this method.. haven't heard of this before. The quiz was not formulated in a very clear way so I basically had no idea how to proceed. This is actually quite simple that high school kids should be able to do with a little python method or whatever language. Here is mine in Java:

	public double estimatePi() {
		int count=0;
		int MAX=100000;
		for (int i=0; i < MAX; i++) {
			double x = Math.random();
			double y = Math.random();
			if (Math.sqrt(x*x+y*y)<1) {
				count++;
			}
		}
		return count*4/(MAX*1.0);
	}
It gets pretty close to 3.14.

Although computers nowadays are pretty fast, but it is expensive (as in time consuming) operation to do square root, and lots of it to get a fair estimate. Math.PI gives you a lot of digits, millions of digits of π are now known there is no more need to estimate it. But nevertheless it is good little math and computer exercise. I lived in darkness because never heard of this method before.

Tuesday, March 14, 2023

One more Java Streams example for Pat Sajak

Let's help Pat Sajak count how many letters in a phrase for Wheel of Fortune
String str = "This maybe helpful for Pat Sajak";

// Turn the string into a list of characters, upper case it
// then recollect it with a groupby

      Map result =
    		  str
		      .chars()
		      .mapToObj(e -> (char)e)
		      .map(c-> Character.toUpperCase(c))
		      .collect(
                      Collectors.groupingBy(
                              Function.identity(), Collectors.counting()
                      )
              );
              
System.out.println(result);
          
Output:
{ =5, A=4, B=1, E=2, F=2, H=2, I=1, J=1, K=1, L=2, M=1, O=1, P=2, R=1, S=2, T=2, U=1, Y=1}
          

Friday, March 10, 2023

Privacy Policy for Solvedoku

Privacy Policy Privacy Policy

Joseph Mak built the Solvedoku app as a Free app. This SERVICE is provided by Joseph Mak at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at Solvedoku unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third-party services that may collect information used to identify you.

Link to the privacy policy of third-party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third-party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third-party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to their Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13 years of age. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do the necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page.

This policy is effective as of 2023-03-10

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at josephmak0865@gmail.com.

This privacy policy page was created at privacypolicytemplate.net and modified/generated by App Privacy Policy Generator

Wednesday, March 8, 2023

Privacy Policy for Art of War

Privacy Policy Privacy Policy

Joseph Mak built the Art of War app as a Free app. This SERVICE is provided by Joseph Mak at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at Art of War unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third-party services that may collect information used to identify you.

Link to the privacy policy of third-party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third-party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third-party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to their Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13 years of age. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do the necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page.

This policy is effective as of 2023-03-08

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at josephmak0865@gmail.com.

This privacy policy page was created at privacypolicytemplate.net and modified/generated by App Privacy Policy Generator

Privacy Policy for 300 Tang Poems

Privacy Policy Privacy Policy

Joseph Mak built the 300 Tang Poem app as a Free app. This SERVICE is provided by Joseph Mak at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at 300 Tang Poem unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not collected by me in any way.

The app does use third-party services that may collect information used to identify you.

Link to the privacy policy of third-party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third-party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third-party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to their Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13 years of age. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do the necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page.

This policy is effective as of 2023-03-08

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at josephmak0865@gmail.com.

This privacy policy page was created at privacypolicytemplate.net and modified/generated by App Privacy Policy Generator

Monday, February 27, 2023

More Java 8 revisited: lambda and java.util.function things

Java 8 has more functional programming stuff

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Consumer;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

public class Test2 {

    // provide 1 abstract method, (the follow annotation is optional)
    @FunctionalInterface
    interface MyFunctionalInterface {
        String doSomeWork(String str);
    }

    // Optional
    public static void myMethodWithOptionalParam(Optional  param) {
        if (!param.isPresent()) System.out.println("You didn't give me a parameter");
        System.out.println("Hey the length is: " + param.orElse("").length());

    }

    public static void main(String arg[]) {


        // Functional Interface
        MyFunctionalInterface myFunctionalInterface = (s -> "hey my friend:" + s);
        System.out.println(myFunctionalInterface.doSomeWork("Johnny"));

        // Function andThen and compose
        Function  myFunction = s -> "take an s and return {" + s + "}";
        Function  myFunction2 = s -> "take another s and return (" + s + ")";
        myFunction = myFunction.andThen(myFunction2);
        System.out.println(myFunction.apply("foo"));

        // f(x) = x/2
        // g(x) = 3x
        // f o g (x) = 3*x/2

        Function  f = x -> x / 2.0;
        Function  g = x -> 3 * x;
        Function  fog = f.compose(g);
        System.out.println(fog.apply(5.0)); // f(g(5))=15/2=7.5

        // func is a function R2 -> R
        BiFunction < Double, Double, Double > hyp = (x, y) -> Math.sqrt(x * x + y * y);
        System.out.println("hypontenuse: " + hyp.apply(3d, 4d));

        // Predicate
        List < String > names = Arrays.asList(
            "Ryu", "Ken", "Blanka", "Bison", "Balrog");

        Predicate  p = (s) -> s.startsWith("B"); // has a test operation

        // Iterate through the list
        for (String st: names) {
            // call the test method
            if (p.test(st))
                System.out.println(st);
        }

        // Consumer has "accept" and can be combined with "andThen"
        Consumer sayHi = (x) -> System.out.println("Hello there: " + x.toLowerCase());
        Consumer sayBye = (x) -> System.out.println("bye now: " + x.toLowerCase());
        sayHi.andThen(sayBye).accept("my friend");

        myMethodWithOptionalParam(Optional.ofNullable("hello world"));
        myMethodWithOptionalParam(Optional.ofNullable(null));
        // myMethodWithOptionalParam(null); won't compile

    }

}
Output
hey my friend:Johnny
take another s and return (take an s and return {foo})
7.5
hypontenuse: 5.0
Blanka
Bison
Balrog
Hello there: my friend
bye now: my friend
Hey the length is: 11
You didn't give me a parameter
Hey the length is: 0

Java 8 Streams revisited

Java 8 has been around for a long time now and its Streams was one of its main new feature, but I doubt too many people actually make a lot of use of it. These can be powerful one liners that let you combine operations.
  List  myList = Arrays.asList(4,56,1,55,12,46);
  System.out.println("original list: "+myList);

  List myListFiltered = myList.stream().filter( n -> n%2 ==0).collect(Collectors.toList());
  System.out.println("even filter: "+myListFiltered);

  long countEven = myList.stream().filter(n -> n %2 ==0).count();
  System.out.println("count of even: "+countEven);

  System.out.println("max: "+  myList.stream().max(Integer::compare).get());
  System.out.println("avg: "+  myList.stream().mapToInt(Integer::intValue).average().getAsDouble());
  System.out.println("sum: "+  myList.stream().mapToInt(i->i).sum());
  System.out.println("sorted: "+myList.stream().sorted().collect(Collectors.toList()));


  List names  = Arrays.asList("ryu","ken", "guile", "chun li", "ryu", "ken");
  System.out.println("some names: "+names);
  List upper = names.stream().map(String::toUpperCase).distinct().sorted().collect(Collectors.toList());
  System.out.println("Sorted and upper and distinct: "+upper);
  
Output
  original list: [4, 56, 1, 55, 12, 46]
even filter: [4, 56, 12, 46]
count of even: 4
max: 56
avg: 29.0
sum: 174
sorted: [1, 4, 12, 46, 55, 56]
some names: [ryu, ken, guile, chun li, ryu, ken]
Sorted and upper and distinct: [CHUN LI, GUILE, KEN, RYU]