Pure CSS, with even less code + animation.
HTML part:
<a data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> Open/Close collapse<i class="fa fa-chevron-right pull-right"></i></a>
CSS:
a[aria-expanded=true] .fa-chevron-right { transition: .3s transform ease-in-out; transform: rotate(90deg);}