Cover photo
Jeffery yuan
Works at Sony
Attended Tongji University
Lives in San Francisco
2,732 followers|950,143 views


Jeffery yuan

J2SE/J2EE/Scala  - 
Removing last object of ArrayList in Java
-- the
list.remove(list.size() - 1) - this is O(1), as numMoved is 0.

JDK should rename remove(int index) to meaningful name such as removeIndex. - and deprecate the old one.
final ArrayList<Integer> a1 = Lists.newArrayList(1, 2, 3);
// a1.remove(a1.get(0)); // remove object
a1.remove((Integer) 1); // remove object
a1.remove(1); // remove index

public E remove(int index) {
rangeCheck(index); // throws an exception if out of bounds

modCount++; // each time a structural change happens
// used for ConcurrentModificationExceptions

E oldValue = elementData(index);

int numMoved = size - index - 1;
if (numMoved > 0)
System.arraycopy(elementData, index+1, elementData, index,
elementData[--size] = null; // Let gc do its work

return oldValue;
 ·  Translate
OVH accompagne votre évolution grâce au meilleur des infrastructures web : hébergement, nom de domaine, serveur dédié, CDN, Cloud, Big Data, ...
Add a comment...

Jeffery yuan

Tips/Tricks/Tools  - 
Use Chrome new tab to take notes
html: data:text/html, <body contenteditable>
plaintext: data:text/html, <textarea contenteditable>
When u accidentally close it, just ctrl+shift+w to reopen it, chrome keeps what u wrote before. Cool!

Add a comment...

Jeffery yuan

Feature Requests/Random Thoughts  - 
G+: Make load next page faster - especailly in mobile
Pre-load next page when user is scrolling in current page.
Add a comment...

Jeffery yuan

Be Better Programmer  - 
I turned 30 last week and a friend asked me if I'd figured out any life advice in the past decade worth passing on. I'm somewhat hesitant to publish this because I think these lists usually seem...
Add a comment...

Jeffery yuan

Feature Requests/Random Thoughts  - 
Express: show which category(the tree of categories) in product details page: so user can easily navigate items in same category.

- In Express, it's difficult to navigate and find what I amy want to buy.
+Google Express +Google Developers 
Add a comment...

Jeffery yuan

Feature Requests/Random Thoughts  - 
Chrome: improve alert box - close current page without having to first close the alert box
If a web site(lots of adware sites) pops up a dialog, we can't close the current windows by ctrl+w or click 'x' button. - actually we can't close any page or switch to another window.

This is kind of annoying.

It would be good if we can close the current tab without having to close the alert box.
Also if the alert box can be limited to and becomes a part of the current page, when we switch to another tab, the alert box is gone(as it's part of the old tab).

+Google Developers +Google Chrome +Google Chrome Developers 
Add a comment...

Jeffery yuan

Code/Team Management  - 
The five keys to a successful Google team
Who is on a team matters less than how the team members interact, structure their work, and view their contributions.
Psychological safety: Can we take risks on this team without feeling insecure or embarrassed?
Dependability: Can we count on each other to do high quality work on time?
Structure & clarity: Are goals, roles, and execution plans on our team clear?
Meaning of work: Are we working on something that is personally important for each of us?
Impact of work: Do we fundamentally believe that the work we’re doing matters?

Add a comment...

Jeffery yuan

Feature Requests/Random Thoughts  - 
Google Now: too many buzz news(tech, political) - focus on user's long term interest - user's career, skill/life improving etc

For me reading buzz news is just a waste of time.

Please recommend me the content that is personalized to me, that matters to me, that I care.
for me, it's programming,

I just watched latest walking dead or Gotham, doesn't mean I want to know more about it.

Know user's occupation, what matters to user, what's the user's long term interest.

Add a comment...

Jeffery yuan

Feature Requests/Random Thoughts  - 
Google Search: sometimes show gibberish when search non-english words + oe=UTF-8&ie=UTF-8
Google search sometimes show gibberish when search Chinese words.

1. copy the url to a new window, still show gibberish.
But if I add oe=UTF-8&ie=UTF-8 at the end, it works well.
2. In the original window, go back and click the enter to research the word, now google search works correctly.

Add a comment...

Jeffery yuan

J2SE/J2EE/Scala  - 
Java Concurrency / Multithreading Tutorial
This tutorial explains core concepts of concurrency, and shows you how to implement them in Java.
Add a comment...
Jeffery's Collections
In his circles
4,285 people
Have him in circles
2,732 people
Frantisek Haluska's profile photo
Chris Wittkamp's profile photo
i ♥ music's profile photo
Lisa Fox's profile photo
subagio utg's profile photo
Lokesh Soni's profile photo
xianhao lv's profile photo
Ritz JB's profile photo
Surabhi Pandey's profile photo
Software Engineer
Java, Linux, Web Development(Jquery, Bootstrap, Javascript, CSS), Solr/Lucene/Nutch, Hadoop, Python, C#, Shell(Bash and bat), Google App Engine, Android, Eclipse(RCP, Plugin Development), Database(MySQL)
  • Sony
    Senior Software Engineer, 2015 - present
    Bug Data: Spark/Cassandra/Lucene/Solr
  • CommVault Systems
    Senior Software Engineer, 2012 - 2015
    Using/Extending Solr/Lucene for enterprise search. Using/Extending Nutch2/Solr for website crawle and search.
  • EMC Corporation
    Senior Software Engineer, 2011 - 2012
    Java Web Services and CMS
  • IBM
    Software Engineer, 2008 - 2011
    Storage, J2SE, Python
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
San Francisco
New Jersey
Senior Developer, Tech passionate, Geek, Dreamer, I am nobody famous nor rich, just like coding and yearn for freedom
I am interested in Linux, Java, Solr, Search, Algorithm, am contributing to 
Bragging rights
I consider myself well versed in these skills: Java, Web development, Linux, MySQL, interested in algorithm, high-level design.
Collections Jeffery is following
View all
  • Tongji University
    Software Engineering, 2005 - 2008
Basic Information
Looking for
Friends, Networking
Jeffery yuan's +1's are the things they like, agree with, or want to recommend.
Find the element that appears once others appears THRICE.

Given an array of integers. All numbers occur thrice except one number which occurs once. Find the number in O(n) time &amp; constant extra spac

LeetCode – Shortest Palindrome (Java)

Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome

Find three closest elements from given three sorted arrays - GeeksforGeeks

Given three sorted arrays A[], B[] and C[], find 3 elements i, j and k from A, B and C respectively such that max(abs(A[i] – B[j]), abs(B[j]

Find the longest path in a matrix with given constraints - GeeksforGeeks

Given a n*n matrix where numbers all numbers are distinct and are distributed from range 1 to n2, find the maximum length path (starting fro

Algo#1: Inorder Predecessor in Binary Tree

Inorder Predecessor value for any node X means value of node Y that comes just before node X while doing Inorder traversal. For given tree i

Algo#2: Inorder Successor in Binary Tree

Inorder Successor value for any node X means value of node Y that comes just after node X while doing Inorder traversal. For given tree in f

Lazy Propagation in Segment Tree - GeeksforGeeks

Segment tree is introduced in previous post with an example of range sum problem. We have used the same “Sum of given Range” problem to expl


This article shows how to configure a Java JRE to use unrestricted cryptographic algorithms.

Find maximum value of Sum( i*arr[i]) with only rotations on given array ...

Given an array, only rotation operation is allowed on array. We can rotate the array as many times as we want. Return the maximum possbile o

Exception Wrapping |

This tutorial explains what exception wrapping is in Java, and why you would use it.

Validation - Throw Exception or Return False?

This tutorial discusses whether you should throw an exception or return false (or a similar error code) when a method receives invalid metho

Logging Exceptions: Where to Log Exceptions? |

This tutorial discusses where to log an exception in your Java applications.

Pluggable Exception Handlers |

Pluggable exception handlers allow the user of an API to plugin an exception handler which converts exceptions thrown in the API to somethin

Fail Safe Exception Handling

This tutorial discusses how to make fail safe exception handling.

Check if a given number is sparse or not - GeeksforGeeks

A number is said to be a sparse number if in binary representation of the number no two or more consecutive bits are set. Write a function t

Food: GoodDecor: GoodService: Good
Public - 3 years ago
reviewed 3 years ago
nice place.
Public - 3 years ago
reviewed 3 years ago
2 reviews