There are many classes where I can do what I call inline method calls.
I want to be able to do this with the SQLite database class ContentValues.
Right now I am doing it this way.
ContentValues cv = new ContentValues(); cv.put("column_name", columnValue); cv.put("column_name", columnValue); cv.put("column_name", columnValue);
I want to be able to do it this way.
new ContentValues().put("column_name", columnValue) .put("column_name:, columnValue) .put("column_name", columnValue);
Is this possible?
According to the docs, all
putmethods have a return typevoid, so it's not possible. The only option is to write it yourself - you can use a wrapper class of your own:Usage: