随笔(十)

1.map.put返回旧的值
ViewModel oldViewModel = mMap.put(key, viewModel);
if (oldViewModel != null) {
    oldViewModel.onCleared();
}
/**
 * Associates the specified value with the specified key in this map.
 * If the map previously contained a mapping for the key, the old
 * value is replaced.
 *
 * @param key key with which the specified value is to be associated
 * @param value value to be associated with the specified key
 * @return the previous value associated with <tt>key</tt>, or
 *         <tt>null</tt> if there was no mapping for <tt>key</tt>.
 *         (A <tt>null</tt> return can also indicate that the map
 *         previously associated <tt>null</tt> with <tt>key</tt>.)
 */
public V put(K key, V value) {
    return putVal(hash(key), key, value, false, true);
}
2.
isAssignableFrom 是用来判断一个类Class1和另一个类Class2是否相同或是另一个类的超类或接口。   
  通常调用格式是   
        Class1.isAssignableFrom (Class2)   
  调用者和参数都是   java.lang.Class   类型。   
      
  而   instanceof   是用来判断一个对象实例是否是一个类或接口的或其子类子接口的实例。   
    格式是:   oo   instanceof   TypeName     
    第一个参数是对象实例名,第二个参数是具体的类名或接口名 
3.
/**
 * Immutable model class for a User
 */
@Entity(tableName = "users")
public class User {

    @NonNull
    @PrimaryKey
    @ColumnInfo(name = "userid")
    private String mId;

    @ColumnInfo(name = "username")
    private String mUserName;

    @Ignore
    public User(String userName) {
        mId = UUID.randomUUID().toString();
        mUserName = userName;
    }

    public User(String id, String userName) {
        this.mId = id;
        this.mUserName = userName;
    }

    public String getId() {
        return mId;
    }

    public String getUserName() {
        return mUserName;
    }
}
@Entity(tableName = "users")
data class User(@PrimaryKey
                @ColumnInfo(name = "userid")
                val id: String = UUID.randomUUID().toString(),
                @ColumnInfo(name = "username")
                val userName: String)

3.
小程序开发
微信小程序开源项目整理(github)

微信小应用示例代码(phodal/weapp-quick) 
源码链接:https://github.com/phodal/weapp-quick

微信小应用地图定位demo(giscafer/wechat-weapp-mapdemo) 
源码链接:https://github.com/giscafer/wechat-weapp-mapdemo

微信小应用- 掘金主页信息流(hilongjw/weapp-gold) 
源码链接:https://github.com/hilongjw/weapp-gold

微信小程序(应用号)示例:微信小程序豆瓣电影(zce/weapp-demo) 
源码链接:https://github.com/zce/weapp-demo

微信小程序-豆瓣电影(hingsir/weapp-douban-film) 
源码链接:https://github.com/hingsir/weapp-douban-film

小程序 hello world 尝鲜(kunkun12/weapp) 
源码链接:https://github.com/kunkun12/weapp

使用微信小程序开发2048游戏(sammffl/wechat-weapp-2048) 
源码链接:https://github.com/sammffl/wechat-weapp-2048

微信小程序-微票(wangmingjob/weapp-weipiao) 
源码链接:https://github.com/wangmingjob/weapp-weipiao

微信小程序购物车DEMO(SeptemberMaples/wechat-weapp-demo) 
源码链接:https://github.com/SeptemberMaples/wechat-weapp-demo

微信小程序V2EX(jectychen/wechat-v2ex) 
源码链接:https://github.com/jectychen/wechat-v2ex

微信小程序-知乎日报(myronliu347/wechat-app-zhihudaily) 
源码链接:https://github.com/myronliu347/wechat-app-zhihudaily

微信小程序-公众号热门文章信息流(hijiangtao/weapp-newsapp) 
源码链接:https://github.com/hijiangtao/weapp-newsapp

微信小程序版Gank客户端 
源码链接:https://github.com/lypeer/wechat-weapp-gank

微信小程序集成Redux实现的Todo list 
源码链接:https://github.com/charleyw/wechat-weapp-redux-todos

微信小程序-番茄时钟 
源码链接:https://github.com/kraaas/timer

微信小程序项目汇总 
源码链接:http://javascript.ctolib.com/cat … t-wechat-weapp.html

微信小程序版聊天室 
源码链接: https://github.com/ericzyh/wechat-chat

微信小程序-HiApp 
源码链接: https://github.com/BelinChung/wxapp-hiapp

小程序Redux绑定库 
源码链接: https://github.com/charleyw/wechat-weapp-redux

微信小程序版微信 
源码链接: https://github.com/18380435477/WeApp

小程序开发从布局开始 
源码链接: https://github.com/hardog/wechat-app-flexlayout

微信小程序-音乐播放器 
源码链接: https://github.com/eyasliu/wechat-app-music

微信小程序-简易计算器-适合入门 
源码链接: https://github.com/dunizb/wxapp-sCalc

微信小程序-github 
源码链接: https://github.com/zhengxiaowai/weapp-github

微信小程序-小熊の日记 
源码链接: https://github.com/harveyqing/BearDiary

微信小程序 
源码链接: https://github.com/SeaHub/PigRaising


微信小程序(WeChatMeiZhi妹子图) 

猜你喜欢

转载自blog.csdn.net/qq_27073205/article/details/80110295